Skip to content

noDuplicateProperties

¥Summary

¥How to configure

biome.json
{
"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