Skip to content

declaration-block-no-shorthand-property-overrides

Reports a shorthand property declared after one of its longhands in the same block (margin-top: 1px; margin: 0), on the longhand.

The shorthand sets every longhand it stands for, so it overwrites the earlier longhand. The longhand does nothing, and the author probably meant it to apply on top of the shorthand.

To fix, put the longhand after the shorthand.

Reported
...
--X: 3;
margin-top: 1px;
margin: 0;
src: a;
src: b;
}
css:
lint:
rules:
declaration-block-no-shorthand-property-overrides: warn # off, warn (default), error
less:
lint:
rules:
declaration-block-no-shorthand-property-overrides: warn # off, warn (default), error
scss:
lint:
rules:
declaration-block-no-shorthand-property-overrides: warn # off, warn (default), error

Enabled by the presets: css/stylelint-recommended.

Suppress one line with sudsy-disable-next-line declaration-block-no-shorthand-property-overrides 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-shorthand-property-overrides full