noDuplicateProperties
¥Summary
-
规则生效日期:
v1.9.4¥Rule available since:
v1.9.4 -
诊断类别:
lint/suspicious/noDuplicateProperties¥Diagnostic Category:
lint/suspicious/noDuplicateProperties -
此规则为推荐规则,默认启用。
¥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": { "noDuplicateProperties": "error" } } }}¥Description
禁止在声明块中使用重复的属性。
¥Disallow duplicate properties within declaration blocks.
此规则检查声明块中是否存在重复属性。忽略自定义属性。
¥This rule checks the declaration blocks for duplicate properties. It ignores custom properties.
¥Examples
¥Invalid
a { color: pink; color: orange;}code-block.css:3:3 lint/suspicious/noDuplicateProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Duplicate properties can lead to unexpected behavior and may override previous declarations unintentionally.
1 │ a {
2 │ color: pink;
> 3 │ color: orange;
│ ^^^^^
4 │ }
5 │
ℹ color is already defined here.
1 │ a {
> 2 │ color: pink;
│ ^^^^^
3 │ color: orange;
4 │ }
ℹ Remove or rename the duplicate property to ensure consistent styling.
¥Valid
a { color: pink; background: orange;}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号