Skip to content

declaration-block-no-duplicate-custom-properties

Reports a custom property declared twice in one block (names are case sensitive), on the repeat.

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.

Reported
...
color: blue;
--x: 1;
--x: 2;
--X: 3;
margin-top: 1px;
...
css:
lint:
rules:
declaration-block-no-duplicate-custom-properties: warn # off, warn (default), error
less:
lint:
rules:
declaration-block-no-duplicate-custom-properties: warn # off, warn (default), error
scss:
lint:
rules:
declaration-block-no-duplicate-custom-properties: warn # off, warn (default), error

Enabled 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.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint declaration-block-no-duplicate-custom-properties full