Skip to main content

selector-disallowed-list

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

¥Specify a list of disallowed selectors.

    .foo > .bar {}
/** ↑

* This is selector */

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

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

选项

¥Options

array|string|regexp["array", "of", "selectors", /or/, "/regex/"]|"selector"|"/regex/"|/regex/

如果字符串被 "/" 包围(例如 "/\.foo/"),则它被解释为正则表达式。

¥If a string is surrounded with "/" (e.g. "/\.foo/"), it is interpreted as a regular expression.

鉴于:

¥Given:

["a > .foo", "/\\[data-.+]/"]

以下模式被视为问题:

¥The following patterns are considered problems:

a > .foo {}
a[data-auto="1"] {}
.foo, [data-auto="1"] {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

.foo {}
a
>
.foo {}
.bar > a > .foo {}
.data-auto {}
a[href] {}

可选的辅助选项

¥Optional secondary options

splitList: true | false(默认:false

¥splitList: true | false (default: false)

将选择器列表拆分为单独的选择器。

¥Split selector lists into individual selectors.

例如,true

¥For example, with true.

鉴于:

¥Given:

[".foo", { "splitList": true }]

以下模式被认为是一个问题:

¥The following pattern is considered a problem:

.bar, .foo {}

以下模式不被视为问题:

¥The following pattern is not considered a problem:

.bar .foo {}

ignore: ["inside-block"]

忽略块内的选择器。

¥Ignore selectors that are inside a block.

鉴于:

¥Given:

[".foo", { "ignore": ["inside-block"] }]

以下模式不被视为问题:

¥The following pattern is not considered a problem:

.bar {
.foo {}
}

ignore: ["keyframe-selectors"]

忽略关键帧选择器。

¥Ignore keyframe selectors.

鉴于:

¥Given:

["/from/", { "ignore": ["keyframe-selectors"] }]

以下模式不被视为问题:

¥The following pattern is not considered a problem:

@keyframes fade-in {
from {}
}