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
:{ "selector": ["array", "of", "properties", "/regex/", /regex/]|"property"|"/regex/"|/regex/
如果选择器名称被 "/"
包围(例如 "/anchor/"
),则它被解释为正则表达式。例如,这可以轻松定位所有潜在的锚点:/anchor/
将匹配 .anchor
、[data-anchor]
等。
¥If a selector name is surrounded with "/"
(e.g. "/anchor/"
), it is interpreted as a regular expression. This allows, for example, easy targeting of all the potential anchors: /anchor/
will match .anchor
, [data-anchor]
, etc.
属性也是如此。请记住,正则表达式值与整个属性名称匹配,而不是其特定部分。例如,像 "animation-duration"
这样的值不会匹配 "/^duration/"
(注意行边界的开头),但会匹配 "/duration/"
。
¥The same goes for properties. Keep in mind that a regular expression value is matched against the entire property name, not specific parts of it. For example, a value like "animation-duration"
will not match "/^duration/"
(notice beginning of the line boundary) but will match "/duration/"
.
鉴于:
¥Given:
{
"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: ["keyframe-selectors"]
忽略关键帧选择器。
¥Ignore keyframe selectors.
鉴于:
¥Given:
[{ "/^[a-z]+$/": ["opacity"] }, { "ignore": ["keyframe-selectors"] }]
以下模式不被视为问题:
¥The following pattern is not considered a problem:
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}