
rules.scsslint.MergeableSelector.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-web-frontend-scss Show documentation
Show all versions of sonar-web-frontend-scss Show documentation
Consume reports generated by scsslint for code quality. Also consume reports for code duplication (either simian or cpd). The information generated by reports are added in Sonar
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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy