Skip to main content
Version: Latest (Core: 0.57.x, Azure: 0.43.x)

Linter

Usage​

Add the following in tspconfig.yaml:

linter:
extends:
- "@azure-tools/typespec-azure-core/all"

RuleSets​

Available ruleSets:

  • @azure-tools/typespec-azure-core/all
  • @azure-tools/typespec-azure-core/canonical-versioning

Rules​

NameDescription
@azure-tools/typespec-azure-core/operation-missing-api-versionOperations need an api version parameter.
@azure-tools/typespec-azure-core/auth-requiredEnforce service authentication.
@azure-tools/typespec-azure-core/request-body-problemRequest body should not be of raw array type.
@azure-tools/typespec-azure-core/byosUse the BYOS pattern recommended for Azure Services.
@azure-tools/typespec-azure-core/casing-styleEnsure proper casing style.
@azure-tools/typespec-azure-core/composition-over-inheritanceCheck that if a model is used in an operation and has derived models that it has a discriminator or recommend to use composition via spread or is.
@azure-tools/typespec-azure-core/known-encodingCheck for supported encodings.
@azure-tools/typespec-azure-core/long-running-polling-operation-requiredLong-running operations should have a linked polling operation.
@azure-tools/typespec-azure-core/no-closed-literal-unionUnions of literals should include the base scalar type to mark them as open enum.
@azure-tools/typespec-azure-core/no-enumAzure services should not use enums.
@azure-tools/typespec-azure-core/no-error-status-codesRecommend using the error response defined by Azure REST API guidelines.
@azure-tools/typespec-azure-core/no-explicit-routes-resource-opsThe @route decorator should not be used on standard resource operation signatures.
@azure-tools/typespec-azure-core/non-breaking-versioningCheck that only backward compatible versioning change are done to a service.
@azure-tools/typespec-azure-core/no-generic-numericDon't use generic types. Use more specific types instead.
@azure-tools/typespec-azure-core/no-nullableUse ? for optional properties.
@azure-tools/typespec-azure-core/no-offsetdatetimePrefer using utcDateTime when representing a datetime unless an offset is necessary.
@azure-tools/typespec-azure-core/no-response-bodyEnsure that the body is set correctly for the response type.
@azure-tools/typespec-azure-core/no-rpc-path-paramsOperations defined using RpcOperation should not have path parameters.
@azure-tools/typespec-azure-core/no-operation-idOperation ID is automatically generated by the OpenAPI emitters and should not normally be specified.
@azure-tools/typespec-azure-core/prefer-csv-collection-formatIt is recommended to use "csv" for collection format of parameters.
@azure-tools/typespec-azure-core/no-formatAzure services should not use the @format decorator.
@azure-tools/typespec-azure-core/no-multiple-discriminatorClasses should have at most one discriminator.
@azure-tools/typespec-azure-core/no-rest-library-interfacesResource interfaces from the TypeSpec.Rest.Resource library are incompatible with Azure.Core.
@azure-tools/typespec-azure-core/no-unknownAzure services must not have properties of type unknown.
@azure-tools/typespec-azure-core/property-name-conflictAvoid naming conflicts between a property and a model of the same name.
@azure-tools/typespec-azure-core/bad-record-typeIdentify bad record definitions.
@azure-tools/typespec-azure-core/documentation-requiredRequire documentation over enums, models, and operations.
@azure-tools/typespec-azure-core/key-visibility-requiredKey properties need to have an explicit visibility setting.
@azure-tools/typespec-azure-core/response-schema-problemWarn about operations having multiple non-error response schemas.
@azure-tools/typespec-azure-core/rpc-operation-request-bodyWarning for RPC body problems.
@azure-tools/typespec-azure-core/spread-discriminated-modelCheck a model with a discriminator has not been used in composition.
@azure-tools/typespec-azure-core/use-standard-namesUse recommended names for operations.
@azure-tools/typespec-azure-core/use-standard-operationsOperations should be defined using a signature from the Azure.Core namespace.
@azure-tools/typespec-azure-core/no-string-discriminatorAzure services discriminated models should define the discriminated property as an extensible union.