noDuplicateProperties (CSS)
Language CSS
Summary
Section titled “Summary”- Rule available since:
v1.9.4 - Diagnostic Category:
lint/suspicious/noDuplicateProperties - This rule is recommended, meaning it is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "suspicious": { "noDuplicateProperties": "error" } } }}Description
Section titled “Description”Disallow duplicate properties within declaration blocks.
This rule checks the declaration blocks for duplicate properties. It ignores custom properties and declarations inside @keyframes blocks.
SCSS limitations
Section titled “SCSS limitations”Declarations are compared within each authored declaration block. The rule does not expand mixins or includes, so duplicates introduced only after SCSS expansion are not reported.
Examples
Section titled “Examples”Invalid
Section titled “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.
a { color: pink; background: orange;}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.