Skip to content

dollar-variable-empty-line-before

Reports a $variable declaration with no empty line before it. One that is first in its block, right after a comment or another $ variable, or in a single-line block is not reported.

A group of Sass variables is the settings of a block, and a gap before it sets it off from the rules and declarations around, so the settings are easy to find.

With this configuration:

dollar-variable-empty-line-before: warn
custom-property-empty-line-before: warn
double-slash-comment-empty-line-before: warn
no-empty-comment: { level: warn, options: { separators: true } }
Reported
...
.x {
$d: 4;
color: red;
$e: 5;
...
--g: 7;
...
css:
lint:
rules:
dollar-variable-empty-line-before: warn # off (default), warn, error
less:
lint:
rules:
dollar-variable-empty-line-before: warn # off (default), warn, error
scss:
lint:
rules:
dollar-variable-empty-line-before: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

Suppress one line with sudsy-disable-next-line dollar-variable-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-scss scss/dollar-variable-empty-line-before full