selector-max-universal
限制选择器中通用选择器的数量。
¥Limit the number of universal selectors in a selector.
* {}
/** ↑
* This universal selector */
此规则在计算通用选择器的数量之前解析嵌套选择器。选择器列表 中的每个选择器都是单独评估的。
¥This rule resolves nested selectors before counting the number of universal selectors. Each selector in a selector list is evaluated separately.
逻辑组合伪类(例如 :not
、:has
)也单独评估。该规则将参数视为独立选择器,并且结果不计入整个选择器的总数。
¥The logical combinations pseudo-class (e.g. :not
, :has
) is also evaluated separately. The rule processes the argument as if it were an independent selector, and the result does not count toward the total for the entire selector.
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
int
:允许的最大通用选择器。
¥int
: Maximum universal selectors allowed.
例如,对于 2
:
¥For example, with 2
:
以下模式被视为问题:
¥The following patterns are considered problems:
* * * {}
* * {
& * {}
}
* * {
& > * {}
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
* {}
* * {}
.foo * {}
*.foo * {}
/* each selector in a selector list is evaluated separately */
*.foo,
*.bar * {}
/* `*` is inside `:not()`, so it is evaluated separately */
* > * .foo:not(*) {}
可选的辅助选项
¥Optional secondary options
ignoreAfterCombinators: ["array", "of", "combinators"]
忽略指定组合器之一之后的通用选择器。
¥Ignore universal selectors that come after one of the specified combinators.
鉴于:
¥Given:
[">", "+"]
例如,2
。
¥For example, with 2
.
以下模式不被视为问题:
¥The following pattern is not considered a problem:
* * > * {}