Skip to content

Latest commit

 

History

History
115 lines (82 loc) · 1.75 KB

File metadata and controls

115 lines (82 loc) · 1.75 KB

No empty rules

Disallow empty rules and at-rules (including those containing only comments).

a {
/* ^ */
}

Empty rules add noise to stylesheets without affecting styling. Rules that contain only comments provide no declarations and should be removed or filled with actual styles.

Options

true

The following are considered problems:

a {}
a { /* comment */ }
@media screen {}
@media screen { /* comment */ }
a { &:hover {} }

The following patterns are not considered problems:

a { color: red; }
@media screen { a { color: red; } }
a { &:hover { color: red; } }
@charset "UTF-8";

Secondary options

allow: Array<"rules" | "atrules" | "comments">

"rules"

Allow empty regular CSS rules (selector blocks).

The following is not considered a problem:

/* "rules" */
a {}

"atrules"

Allow empty at-rules (at-rule blocks with no content).

The following is not considered a problem:

/* "atrules" */
@media screen {}

"comments"

Allow rules and at-rules whose only content is comments.

The following are not considered problems:

/* "comments" */
a { /* comment */ }
/* "comments" */
@media screen { /* comment */ }

Prior art