Ban unnecessary @at-root
rule.
The @at-root
rule is redundant in the following cases:
- If
@at-root
is already at the root of the document. - If any
@at-root
selector contains the parent selector,&
, outside interpolation. - If
@at-root
is nested within a@keyframes
block.
The following patterns are considered warnings:
@at-root .a { margin: 3px; }
.a { @at-root .b & { margin: 3px; } }
@keyframes slidein {
@at-root from {
transform: translateX(0%);
}
to {
transform: translateX(100%);
}
}
The following patterns are not considered warnings:
.a { @at-root .b { margin: 3px; } }
.a { @at-root .b#{&} { margin: 3px; } }
.a {
@at-root .b {
@keyframes slidein {
from {
transform: translateX(0%);
}
to {
transform: translateX(100%);
}
}
}
}