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>

["array", "of", "selectors", "/regex/"]

鉴于:

¥Given:

{
"selector-disallowed-list": ["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

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

¥Split selector lists into individual selectors. Defaults to false.

鉴于:

¥Given:

{
"selector-disallowed-list": [".foo", { "splitList": true }]
}

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

¥The following pattern is considered a problem:

.bar, .foo {}

以下模式不被视为问题:

¥The following pattern is not considered a problem:

.bar .foo {}

ignore

{ "ignore": ["array", "of", "options"] }

"inside-block"

忽略块内的选择器。

¥Ignore selectors that are inside a block.

鉴于:

¥Given:

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

以下模式不被视为问题:

¥The following pattern is not considered a problem:

.bar {
.foo {}
}

"keyframe-selectors"

忽略关键帧选择器。

¥Ignore keyframe selectors.

鉴于:

¥Given:

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

以下模式不被视为问题:

¥The following pattern is not considered a problem:

@keyframes fade-in {
from {}
}