declaration-block-single-line-max-declarations
What it does
Section titled “What it does”Reports a block written on one line that has more declarations than the max option.
Why it matters
Section titled “Why it matters”A single-line block is easy to scan only while it is short; with many declarations the line becomes long, and a diff shows the whole line as changed. A limit (often 1) moves the rest to separate lines.
Example
Section titled “Example”....h { color: red; margin: 0 }.i { color: red; margin: 0;}.j { width: 1.23456px; height: 10.5%; opacity: 0.12345 }Configuration
Section titled “Configuration”css: lint: rules: declaration-block-single-line-max-declarations: level: warn # off (default), warn, error options: max: 1less: lint: rules: declaration-block-single-line-max-declarations: level: warn # off (default), warn, error options: max: 1scss: lint: rules: declaration-block-single-line-max-declarations: level: warn # off (default), warn, error options: max: 1| Option | Type | Default | Description |
|---|---|---|---|
max |
int | 1 |
The most declarations a single-line block may have. |
Enabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line declaration-block-single-line-max-declarations in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| stylelint | declaration-block-single-line-max-declarations |
partial | differs from stylelint on single-line @font-face blocks |