Skip to content

rule-empty-line-before

Reports a rule whose block spans several lines and has no empty line before it. A rule that is first in its block, and one right after a comment, need none.

An empty line between rules shows where one rule ends and the next starts, and keeps a long file scannable. A rule that opens a block has nothing to be separated from, and a comment belongs to the rule below it.

Reported
...
c { color: red;
top: 0; }
d { color: red;
top: 0; }
/* comment */
e { color: red; }
...
/* c */
right: 0;
g { x: y }
h { x: y;
...
x { --a: 1;
--b: 2;
--c: 3;
...
y {
...
}
css:
lint:
rules:
rule-empty-line-before: warn # off (default), warn, error
less:
lint:
rules:
rule-empty-line-before: warn # off (default), warn, error
scss:
lint:
rules:
rule-empty-line-before: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

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