rules.scsslint.MergeableSelector.html Maven / Gradle / Ivy
Details
Reports when you define the same selector twice in a single sheet.
Bad
h1 {
margin: 10px;
}
.baz {
color: red;
}
// Second copy of h1 rule
h1 {
text-transform: uppercase;
}
Good
h1 {
margin: 10px;
text-transform: uppercase;
}
.baz {
color: red;
}
Combining duplicate selectors can result in an easier to read sheet, but
occasionally the rules may be purposely duplicated to set precedence
after a rule with the same CSS specificity. However, coding your
stylesheets in this way makes them more difficult to comprehend, and can
usually be avoided.
You can specify that rule sets which can be nested within another rule
set must be nested via the force_nesting
option, e.g.
Bad
h1 {
color: #fff;
}
h1.new {
color: #000;
}
Good
h1 {
color: #fff;
&.new {
color: #000;
}
}
Configuration Option
Description
force_nesting
Ensure rule sets which can be nested are nested (default true)
whitelist
A list of selectors that can MergeableSelector, list those used in CSS Shims