noUnmatchableAnbSelector
¥Summary
-
规则生效日期:
v1.8.0¥Rule available since:
v1.8.0 -
诊断类别:
lint/correctness/noUnmatchableAnbSelector¥Diagnostic Category:
lint/correctness/noUnmatchableAnbSelector -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
selector-anb-no-unmatchable相同¥Same as
selector-anb-no-unmatchable
-
¥How to configure
{ "linter": { "rules": { "correctness": { "noUnmatchableAnbSelector": "error" } } }}¥Description
禁止不匹配的 An+B 选择器。
¥Disallow unmatchable An+B selectors.
始终求值为 0 的选择器将不匹配任何元素。有关 An+B 语法的更多详细信息,请参阅:https://www.w3.org/TR/css-syntax-3/#anb-microsyntax
¥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
¥Invalid
a:nth-child(0) {}code-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.
a:nth-last-child(0n) {}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.
a:nth-of-type(0n+0) {}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.
a:nth-last-of-type(0 of a) {}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.
¥Valid
a:nth-child(1) {}a:nth-last-child(1n) {}a:nth-of-type(1n+0) {}a:nth-last-of-type(1 of a) {}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号