src/content/docs/linter/rules/no-unmatchable-anb-selector.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="CSS" icon="seti:css"> ## Summary - Rule available since: `v1.8.0` - Diagnostic Category: [`lint/correctness/noUnmatchableAnbSelector`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`selector-anb-no-unmatchable`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-anb-no-unmatchable/README.md){
"linter": {
"rules": {
"correctness": {
"noUnmatchableAnbSelector": "error"
}
}
}
}
Disallow unmatchable An+B selectors.
Selectors that always evaluate to 0 will not match any elements. For more details about the An+B syntax, see: https://www.w3.org/TR/css-syntax-3/#anb-microsyntax
a:nth-child(0) {}
a:nth-last-child(0n) {}
a:nth-of-type(0n+0) {}
a:nth-last-of-type(0 of a) {}
a:nth-child(1) {}
a:nth-last-child(1n) {}
a:nth-of-type(1n+0) {}
a:nth-last-of-type(1 of a) {}