Pattern: Malformed empty line before at-rule
Issue: -
Require or disallow an empty line before at-rules.
If the at-rule is the very first node in a stylesheet then it is ignored. @import
in Less will also be ignored.
There must always be an empty line before at-rules.
The following patterns are considered violations:
a {} @media {}
a {}
@media {}
The following patterns are not considered violations:
a {}
@media {}
There must never be an empty line before at-rules.
The following patterns are considered violations:
a {}
@media {}
The following patterns are not considered violations:
a {} @media {}
a {}
@media {}
except: ["after-same-name", "inside-block", "blockless-after-same-name-blockless", "blockless-after-blockless", "first-nested"]
Reverse the primary option for at-rules that follow another at-rule with the same name.
This means that you can group your at-rules by name.
For example, with "always"
:
The following patterns are not considered violations:
@charset "UTF-8";
@import url(x.css);
@import url(y.css);
@media (min-width: 100px) {}
@media (min-width: 200px) {}
a {
@extends .foo;
@extends .bar;
@include x;
@include y {}
}
Reverse the primary option for at-rules that are nested.
For example, with "always"
:
The following patterns are considered violations:
a {
@extend foo;
color: pink;
}
b {
color: pink;
@extend foo;
}
The following patterns are not considered violations:
a {
@extend foo;
color: pink;
}
b {
color: pink;
@extend foo;
}
Reverse the primary option for blockless at-rules that follow another blockless at-rule with the same name.
This means that you can group your blockless at-rules by name.
Shared-line comments do not affect this option.
For example, with "always"
:
The following patterns are not considered violations:
@charset "UTF-8";
@import url(x.css);
@import url(y.css);
@charset "UTF-8";
@import url(x.css); /* comment */
@import url(y.css);
a {
@extends .foo;
@extends .bar;
@include loop;
@include doo;
}
Reverse the primary option for at-rules within a blockless group.
Shared-line comments do not affect this option.
For example, with "always"
:
The following patterns are considered violations:
@import url(x.css);
@import url(y.css);
@media print {}
The following patterns are not considered violations:
@import url(x.css);
@import url(y.css);
@media print {}
@import url(x.css); /* comment */
@import url(y.css);
@media print {}
Reverse the primary option for at-rules that are nested and the first child of their parent node.
For example, with "always"
:
The following patterns are considered violations:
a {
@extend foo;
color: pink;
}
b {
color: pink;
@extend foo;
}
The following patterns are not considered violations:
a {
@extend foo;
color: pink;
}
b {
color: pink;
@extend foo;
}
ignore: ["after-comment", "inside-block", "blockless-after-same-name-blockless", "blockless-after-blockless"]
Ignore at-rules that come after a comment.
Shared-line comments do not trigger this option.
The following patterns are not considered violations:
/* comment */
@media {}
/* comment */
@media {}
@media {} /* comment */
@media {}
Ignore at-rules that are inside a declaration block.
For example, with "always"
:
The following patterns are not considered violations:
a {
@extend foo;
color: pink;
}
a {
@extend foo;
color: pink;
}
b {
color: pink;
@extend foo;
}
b {
color: pink;
@extend foo;
}
Ignore blockless at-rules that follow another blockless at-rule with the same name.
This means that you can group your blockless at-rules by name.
For example, with "always"
:
The following patterns are not considered violations:
@charset "UTF-8";
@import url(x.css);
@import url(y.css);
a {
@extends .foo;
@extends .bar;
@include loop;
@include doo;
}
Ignore blockless at-rules that follow another blockless at-rule.
For example, with "always"
:
The following patterns are not considered violations:
@import url(x.css);
@import url(y.css);
@media print {}
@import url(x.css);
@import url(y.css);
@media print {}
Ignore specified at-rules.
For example, with "always"
.
Given:
["import"]
The following patterns are not considered violations:
@charset "UTF-8";
@import {}