noDuplicateCustomProperties
¥Summary
-
规则生效日期:
v1.9.0¥Rule available since:
v1.9.0 -
诊断类别:
lint/suspicious/noDuplicateCustomProperties¥Diagnostic Category:
lint/suspicious/noDuplicateCustomProperties -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
¥How to configure
{ "linter": { "rules": { "suspicious": { "noDuplicateCustomProperties": "error" } } }}¥Description
禁止在声明块中重复自定义属性。
¥Disallow duplicate custom properties within declaration blocks.
此规则检查声明块中是否存在重复的自定义属性。
¥This rule checks the declaration blocks for duplicate custom properties.
¥Examples
¥Invalid
a { --custom-property: pink; --custom-property: orange; }code-block.css:1:30 lint/suspicious/noDuplicateCustomProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Duplicate custom properties can lead to unexpected behavior and may override previous declarations unintentionally.
> 1 │ a { —custom-property: pink; —custom-property: orange; }
│ ^^^^^^^^^^^^^^^^^
2 │
ℹ —custom-property is already defined here.
> 1 │ a { —custom-property: pink; —custom-property: orange; }
│ ^^^^^^^^^^^^^^^^^
2 │
ℹ Remove or rename the duplicate custom property to ensure consistent styling.
a { --custom-property: pink; background: orange; --custom-property: orange }code-block.css:1:50 lint/suspicious/noDuplicateCustomProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Duplicate custom properties can lead to unexpected behavior and may override previous declarations unintentionally.
> 1 │ a { —custom-property: pink; background: orange; —custom-property: orange }
│ ^^^^^^^^^^^^^^^^^
2 │
ℹ —custom-property is already defined here.
> 1 │ a { —custom-property: pink; background: orange; —custom-property: orange }
│ ^^^^^^^^^^^^^^^^^
2 │
ℹ Remove or rename the duplicate custom property to ensure consistent styling.
¥Valid
a { --custom-property: pink; }a { --custom-property: pink; --cUstOm-prOpErtY: orange; }¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号