
rules.scsslint.QualifyingElement.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
Avoid qualifying elements in selectors (also known as "tag-qualifying").
Bad: qualifying elements
div#thing {
...
}
ul.list {
...
}
ul li.item {
...
}
a[href="place"] {
...
}
Good
#thing {
...
}
.list {
...
}
ul .item {
...
}
[href="place"] {
...
}
Since IDs are unique, they will not apply to multiple elements, so there is no
good reason to qualify an ID selector with an element.
In most cases, qualifying a class or attribute selector with an element adds
unnecessary or undesirable specificity. Often the element qualifier is
already superfluous; and if it is not, you will probably be better off
refactoring so that it can be removed.
Use the options to allow certain qualifying elements.
Configuration Option
Description
allow_element_with_attribute
Allow elements to qualify attributes (default false)
allow_element_with_class
Allow elements to qualify classes (default false)
allow_element_with_id
Allow elements to qualify ids (default false)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy