Skip to main content

rule-selector-property-disallowed-list

指定规则中选择器不允许的属性列表。

¥Specify a list of disallowed properties for selectors within rules.

    a { color: red; }
/** ↑ ↑

* Selector and property name */

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

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

选项

¥Options

Object<string, Array<string>>

{ "selector": ["array", "of", "properties", "/regex/"] }

您可以为选择器指定正则表达式,例如 { "/foo-/": [] }

¥You can specify a regex for a selector, such as { "/foo-/": [] }.

鉴于:

¥Given:

{
"rule-selector-property-disallowed-list": {
"a": ["color", "/margin/"],
"/foo/": ["/size/"]
}
}

以下模式被视为问题:

¥The following patterns are considered problems:

a { color: red; }
a { margin-top: 0px; }
html[data-foo] { font-size: 1px; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { background: red; }
a { padding-top: 0px; }
html[data-foo] { color: red; }

可选的辅助选项

¥Optional secondary options

ignore

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

"keyframe-selectors"

忽略关键帧选择器。

¥Ignore keyframe selectors.

鉴于:

¥Given:

{
"rule-selector-property-disallowed-list": [
{ "/^[a-z]+$/": ["opacity"] },
{ "ignore": ["keyframe-selectors"] }
]
}

以下模式不被视为问题:

¥The following pattern is not considered a problem:

@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}