New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document !important caveat in no-descending-specificity #3052
Comments
Thanks for the report and for using the template. Rule checks selectors only. It doesn't check declarations in a rule, and whether rule with lower selector specificity has declaration which is outweights declaration in a rule with higher selector specificity.
On the other side it's still show violations if there is a clearly a set of more specific selectors: a,
a:hover,
a:active {
color: #6c9cd3;
}
footer a,
footer a:hover,
footer a:active {
color: white;
}
While rule is still works as expected and reports correctly, it feels incorrect. You can disable violation for this use case: a,
a:hover,
a:active {
color: #6c9cd3;
}
/* stylelint-disable-next-line no-descending-specificity */
footer a {
color: white;
} |
@hudochenkov Thanks for digging into this. I suggest we document this caveat. |
There is a similar glitch with no-descending-specificity when using the same version of stylelint and stylelint-config-standard
Here I don't feel like any rule is more specific than another so I don't expect and message, nevertheless I get :
If this is a normal behaviour this should be documented too. |
In the two violations above, the rules are more specific e.g. both
Having said that, I wonder whether the worth of this rule is diminished in this instance as the parent is different in both instances. In that regard, this instance feels related to #2489, which is to do with parents and pseudo-classes. Perhaps once that issue is resolved (@aloxe, feel free to pick it up), then we'll have to clearer picture of how to address your particular instance. |
This issue is older than one month. Please ask before opening a pull request, as it may no longer be relevant. |
A bug where the rule claims wrong ordering.
no-descending-specificity
"stylelint": "^8.3.1",
"stylelint-config-standard": "^18.0.0",
8.3.1
npm with
stylelint "src/**/*.css"
no
No warnings to be flagged
The following warnings were flagged:
The text was updated successfully, but these errors were encountered: