at-rule-empty-line-before
What it does
Section titled “What it does”Reports an at-rule with no empty line before it. The first at-rule of a block, one right after a comment, and a blockless at-rule right after a blockless one of the same name (a run of @import lines) need none. @else is not checked.
Why it matters
Section titled “Why it matters”Blank lines separate the blocks of a stylesheet, so an @media or @include that follows a declaration or a rule stays visible as its own unit. A run of @import or @use lines is one list and stays together.
Example
Section titled “Example”@import "a.css";@import "b.css";
@import "c.css";a { color: red; }b { color: red; }
... g { x: y }... @media (a) { top: 0; }...}@media (a) { top: 0; }@media (b) { top: 0; }@font-face { font-family: x; }... --b: 2;
... @media (b) { top: 0; }}Configuration
Section titled “Configuration”css: lint: rules: at-rule-empty-line-before: warn # off (default), warn, errorless: lint: rules: at-rule-empty-line-before: warn # off (default), warn, errorscss: lint: rules: at-rule-empty-line-before: warn # off (default), warn, errorEnabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line at-rule-empty-line-before in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | at-rule-empty-line-before |
full |