Skip to content

declaration-block-single-line-max-declarations

Reports a block written on one line that has more declarations than the max option.

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.

Reported
...
.h { color: red; margin: 0 }
.i {
color: red; margin: 0;
}
.j { width: 1.23456px; height: 10.5%; opacity: 0.12345 }
css:
lint:
rules:
declaration-block-single-line-max-declarations:
level: warn # off (default), warn, error
options:
max: 1
less:
lint:
rules:
declaration-block-single-line-max-declarations:
level: warn # off (default), warn, error
options:
max: 1
scss:
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.

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