线条规则——使用描述类型属性

该规则要求用户自定义对象类型的属性必须有非空 @description 装饰器。 清晰的描述解释了类型中的期望值。

注释

此规则默认关闭。 在 bicepconfig.json 里更改电平以启用它。 该规则还评估用 宣告的 *附加属性。

Linter 规则代码

请在 Bicep 配置文件中使用以下值自定义规则设置:

use-description-type-properties

解决方案

以下类型不符合此规则,因为其属性没有描述:

type StorageConfig = {
  name: string
  sku: string
}

为解决这个问题,可以在每个属性上添加一个非空 @description 装饰器:

type StorageConfig = {
  @description('The name of the storage account.')
  name: string

  @description('The SKU of the storage account.')
  sku: string
}

后续步骤

有关 Linter 的详细信息,请参阅使用 Bicep Linter