Skip to content

block-no-empty

Reports a rule or at-rule block with nothing in it, comments included.

An empty block does nothing. It is a leftover of a deleted declaration or a placeholder that was never filled, and it adds bytes and noise to the file.

To fix, delete the rule, or put the declarations in it.

Reported
a {}
b { }
c { /* kept */ }
@media print {}
d { color: red }
css:
lint:
rules:
block-no-empty: warn # off (default), warn, error
less:
lint:
rules:
block-no-empty: warn # off (default), warn, error
scss:
lint:
rules:
block-no-empty: warn # off (default), warn, error

Enabled by the presets: css/stylelint-recommended.

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