Skip to main content

selector-pseudo-class-disallowed-list

指定不允许的伪类选择器的列表。

¥Specify a list of disallowed pseudo-class selectors.

  a:hover {}
/** ↑

* This pseudo-class selector */

该规则忽略使用变量插值的选择器,例如 :#{$variable} {}

¥This rule ignores selectors that use variable interpolation e.g. :#{$variable} {}.

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

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

选项

¥Options

array|string|regex["array", "of", "unprefixed", /pseudo-classes/, "/regex/"]|"pseudo-class"|"/regex/"|/regex/

如果字符串被 "/" 包围(例如 "/^nth-/"),则它被解释为正则表达式。例如,这可以轻松定位简写:/^nth-/ 将匹配 nth-childnth-last-childnth-of-type 等。

¥If a string is surrounded with "/" (e.g. "/^nth-/"), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: /^nth-/ will match nth-child, nth-last-child, nth-of-type, etc.

鉴于:

¥Given:

["hover", "/^nth-/"]

以下模式被视为问题:

¥The following patterns are considered problems:

a:hover {}
a:nth-of-type(5) {}
a:nth-child(2) {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a:focus {}
a:first-of-type {}