跳到主要內容

declaration-block-no-duplicate-custom-properties

禁止在宣告區塊中重複自訂屬性。

a { --custom-property: pink; --custom-property: orange; }
/** ↑ ↑
* These duplicated custom properties */

此規則區分大小寫。

message 次要選項可以接受此規則的參數。

選項

true

以下模式被視為問題

a { --custom-property: pink; --custom-property: orange; }
a { --custom-property: pink; background: orange; --custom-property: orange }

以下模式不會被視為問題

a { --custom-property: pink; }
a { --custom-property: pink; --cUstOm-prOpErtY: orange; }

可選次要選項

ignoreProperties: ["/regex/", /regex/, "non-regex"]

忽略特定屬性的重複。

給定

["--custom-property", "/ignored/"]

以下模式被視為問題

a { --another-custom-property: 1; --another-custom-property: 1; }

以下模式不會被視為問題

a { --custom-property: 1; --custom-property: 1; }
a { --custom-ignored-property: 1; --custom-ignored-property: 1; }