Skip to main content

selector-anb-no-unmatchable

禁止使用不匹配的 An+B 选择器。

¥Disallow unmatchable An+B selectors.

a:nth-child(0n+0) {}
/*↑ ↑

* This unmatchable An+B selector */

An+B 选择器 是单索引的。始终评估为 0 的选择器将不会匹配任何元素。

¥An+B selectors are one-indexed. Selectors that always evaluate to 0 will not match any elements.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a:nth-child(0) {}
a:nth-last-child(0n) {}
a:nth-of-type(0n+0) {}
a:nth-last-of-type(0 of a) {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a:nth-child(1) {}
a:nth-last-child(1n) {}
a:nth-of-type(1n+0) {}
a:nth-last-of-type(1 of a) {}