Skip to content

declaration-empty-line-before

Reports a declaration that follows a rule or at-rule and has no empty line before it. A declaration after another declaration, one first in its block, one right after a comment, one in a single-line block, and custom properties and variables are not reported.

Declarations that come after a nested rule belong to the parent again, and without a gap they read as part of the nested block. An empty line shows the return to the parent.

Reported
...
f {
color: red;
top: 0;
left: 0;
/* c */
right: 0;
g { x: y }
...
bottom: 0;
}
...
--b: 2;
--c: 3;
color: red; }
...
css:
lint:
rules:
declaration-empty-line-before: warn # off (default), warn, error
less:
lint:
rules:
declaration-empty-line-before: warn # off (default), warn, error
scss:
lint:
rules:
declaration-empty-line-before: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

Suppress one line with sudsy-disable-next-line declaration-empty-line-before 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-empty-line-before full