Require an empty line or disallow empty lines before $
-variable declarations.
If the $
-variable declaration is the first declaration in a file, it's ignored.
/* ← */
$width: 10px; ↑
/** ↑
* This empty line */
The --fix
option on the command line can automatically fix all of the problems reported by this rule.
string
: "always"|"never"
There must always be one empty line before a $
-variable declaration.
The following patterns are considered warnings:
@import '1.css';
$var2: 200px;
a {
$var: 1;
}
The following patterns are not considered warnings:
$var: 100px; // The first declaration in a stylesheet
a { color: red; }
$var: 1;
There must never be an empty line before a $
-variable declaration.
The following patterns are considered warnings:
a { color: red; }
$var: 1;
The following patterns are not considered warnings:
$var: 100px;
$var2: 200px;
a {
width: auto;
}
$var: 1;
Reverse the primary option for a $
-variable declaration if it's the first child of its parent.
For example, with "always"
:
The following patterns are considered warnings:
a {
$var: 1;
color: red;
}
b {
color: red;
$var: 1;
}
The following patterns are not considered warnings:
a {
$var: 1;
color: red;
}
b {
color: red;
$var: 1;
}
Reverse the primary option for $
-variable declarations that go after comments.
For example, with "always"
:
The following patterns are considered warnings:
a {
// comment
$var: 1;
}
b {
/* comment */
$var: 1;
}
The following patterns are not considered warnings:
a {
// comment
$var: 1;
}
Reverse the primary option for $
-variable declarations that go right after another $
-variable declaration.
For example, with "always"
:
The following patterns are considered warnings:
a {
$var: 1; // this one is ok
$var1: 2; // and this one shouldn't have a preceding empty line
}
The following patterns are not considered warnings:
a {
$var: 1;
$var1: 2;
}
Ignore $
-variables that go after a comment.
For example, with "always"
:
The following patterns are not considered warnings:
// comment
$var: 1
/* comment */
$var2: 1;
Ignore $
-variables that are inside single-line blocks.
For example, with "always"
:
The following patterns are not considered warnings:
a { $var: 10; }
Disables autofixing for this rule.