Skip to content

declaration-block-no-duplicate-properties

Reports a property declared twice in one block, on the earlier declaration (on the later one when only the earlier one is !important). src and custom properties are not reported. With ignore_consecutive_different_values a repeat right after the same property with another value is left alone.

The later declaration replaces the earlier one, so the earlier one does nothing. Most often it is a copy and paste mistake or a leftover of an edit, and the author reads the wrong value as the one in force.

To fix, delete the declaration that is not meant to apply. A deliberate fallback for old browsers (display: -webkit-box; display: flex) can stay with ignore_consecutive_different_values.

Reported
a {
color: red;
color: blue;
--x: 1;
...
css:
lint:
rules:
declaration-block-no-duplicate-properties:
level: warn # off (default), warn, error
options:
ignore_consecutive_different_values: false
less:
lint:
rules:
declaration-block-no-duplicate-properties:
level: warn # off (default), warn, error
options:
ignore_consecutive_different_values: false
scss:
lint:
rules:
declaration-block-no-duplicate-properties:
level: warn # off (default), warn, error
options:
ignore_consecutive_different_values: false
Option Type Default Description
ignore_consecutive_different_values bool false Leave a repeat right after the same property with another value alone (display: -webkit-box; display: flex).

Enabled by the presets: css/stylelint-recommended.

Suppress one line with sudsy-disable-next-line declaration-block-no-duplicate-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-properties full