noUnmatchableAnbSelector
Diagnostic Category: lint/correctness/noUnmatchableAnbSelector
Since: v1.8.0
Sources:
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
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.css:1:13 lint/correctness/noUnmatchableAnbSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This selector will never match any elements.
> 1 │ a:nth-child
(0) {}
│ ^
2 │
ℹ Avoid using An+B selectors that always evaluate to 0.
ℹ For more details, see the official spec for An+B selectors.
code-block.css:1:18 lint/correctness/noUnmatchableAnbSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This selector will never match any elements.
> 1 │ a:nth-last-child
(0n) {}
│ ^^
2 │
ℹ Avoid using An+B selectors that always evaluate to 0.
ℹ For more details, see the official spec for An+B selectors.
code-block.css:1:15 lint/correctness/noUnmatchableAnbSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This selector will never match any elements.
> 1 │ a:nth-of-type
(0n+0) {}
│ ^^^^
2 │
ℹ Avoid using An+B selectors that always evaluate to 0.
ℹ For more details, see the official spec for An+B selectors.
code-block.css:1:20 lint/correctness/noUnmatchableAnbSelector ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This selector will never match any elements.
> 1 │ a:nth-last-of-type
(0 of a) {}
│ ^^^^^^
2 │
ℹ Avoid using An+B selectors that always evaluate to 0.
ℹ For more details, see the official spec for An+B selectors.