selector-anb-no-unmatchable
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports an :nth-child() and the like whose An+B can never match (0, 0n, -n, -2n-1).
Why it matters
Section titled “Why it matters”The selector matches no element, so the rule does nothing. It is a miscalculated formula, or a leftover of a larger one.
To fix, correct the formula; -n+3 matches the first three.
Example
Section titled “Example”...a:nth-child(0), a:nth-child(2n+1), a:nth-last-child(-n) {}...@keyframes k { from { top: 0 } to { top: 1px } }......a:nth-child(0), a:nth-child(2n+1), a:nth-last-child(-n) {}...@keyframes k { from { top: 0 } to { top: 1px } }...Configuration
Section titled “Configuration”css: lint: rules: selector-anb-no-unmatchable: warn # off, warn (default), errorless: lint: rules: selector-anb-no-unmatchable: warn # off, warn (default), errorscss: lint: rules: selector-anb-no-unmatchable: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line selector-anb-no-unmatchable in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | selector-anb-no-unmatchable |
full |