Skip to main content

property-allowed-list

指定允许的属性列表。

¥Specify a list of allowed properties.

a { display: block; }
/** ↑

* This property */

该规则忽略变量($sass@less--custom-property)。

¥This rule ignores variables ($sass, @less, --custom-property).

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

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

选项

¥Options

array|string|regex["array", "of", /properties/, "regex"]|"property"|"/regex/"|/regex/

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

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

鉴于:

¥Given:

["display", "animation", "/^background/"]

以下模式被视为问题:

¥The following patterns are considered problems:

a { color: pink; }
a {
animation: my-animation 2s;
color: pink;
}
a { borkgrund: orange; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { display: block; }
a { -webkit-animation: my-animation 2s; }
a {
animation: my-animation 2s;
-webkit-animation: my-animation 2s;
display: block;
}
a { background: pink; }
a { background-color: pink; }