Skip to content

comment-empty-line-before

Reports a /* */ comment on a line of its own with no empty line before it. One that is first in its block, on the line of code, or a directive comment is not reported. A // comment is another rule’s.

A comment describes what follows, and an empty line before it ties it to the next rule rather than to the end of the previous one.

Reported
/* first */
a { color: red; }
/* needs a line */
/* has one */
b {
/* first in the block */
color: red;
/* needs a line */
/* has one */
top: 0; /* same line */
...
css:
lint:
rules:
comment-empty-line-before: warn # off (default), warn, error
less:
lint:
rules:
comment-empty-line-before: warn # off (default), warn, error
scss:
lint:
rules:
comment-empty-line-before: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

Suppress one line with sudsy-disable-next-line comment-empty-line-before 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 comment-empty-line-before partial // comments are left to double-slash-comment-empty-line-before, as stylelint ignores them