declaration-block-no-shorthand-property-overrides
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesssuspiciousno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports a shorthand property declared after one of its longhands in the same block (margin-top: 1px; margin: 0), on the longhand.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”... --X: 3; margin-top: 1px; margin: 0; src: a; src: b;}Configuration
Section titled “Configuration”css: lint: rules: declaration-block-no-shorthand-property-overrides: warn # off, warn (default), errorless: lint: rules: declaration-block-no-shorthand-property-overrides: warn # off, warn (default), errorscss: lint: rules: declaration-block-no-shorthand-property-overrides: warn # off, warn (default), errorEnabled 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.
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-shorthand-property-overrides |
full |