Skip to content

Linter usage

Add the following in tspconfig.yaml:

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

Available ruleSets:

  • @azure-tools/typespec-azure-core/all
  • @azure-tools/typespec-azure-core/canonical-versioning
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-openapiAzure specs should not be using decorators from @typespec/openapi or @azure-tools/typespec-autorest
@azure-tools/typespec-azure-core/no-header-explodeIt is recommended to serialize header parameter without explode: true
@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/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 a Lifecycle 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.
@azure-tools/typespec-azure-core/require-versionedAzure services should use the versioning library.
@azure-tools/typespec-azure-core/friendly-nameEnsures that @friendlyName is used as intended.
@azure-tools/typespec-azure-core/no-private-usageVerify that elements inside Private namespace are not referenced.
@azure-tools/typespec-azure-core/no-legacy-usageLinter warning against using elements from the Legacy namespace
@azure-tools/typespec-azure-core/no-query-explodeIt is recommended to serialize query parameter without explode: true