declaration-block-no-duplicate-custom-properties
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesssuspiciousno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports a custom property declared twice in one block (names are case sensitive), on the repeat.
Why it matters
Section titled “Why it matters”The later declaration of a custom property wins and the earlier one is lost, so the value that a reader sees first is not the value var() returns. It is almost always a copy and paste mistake.
To fix, delete one of the declarations or rename it.
Example
Section titled “Example”... color: blue; --x: 1; --x: 2; --X: 3; margin-top: 1px;...Configuration
Section titled “Configuration”css: lint: rules: declaration-block-no-duplicate-custom-properties: warn # off, warn (default), errorless: lint: rules: declaration-block-no-duplicate-custom-properties: warn # off, warn (default), errorscss: lint: rules: declaration-block-no-duplicate-custom-properties: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line declaration-block-no-duplicate-custom-properties in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | declaration-block-no-duplicate-custom-properties |
full |