Skip to main content

declaration-block-no-duplicate-custom-properties

禁止声明块内出现重复的自定义属性。

¥Disallow duplicate custom properties within declaration blocks.

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

* These duplicated custom properties */

此规则区分大小写。

¥This rule is case-sensitive.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

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

可选的辅助选项

¥Optional secondary options

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

忽略特定属性的重复项。

¥Ignore duplicates of specific properties.

鉴于:

¥Given:

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

以下模式被视为问题:

¥The following patterns are considered problems:

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

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