Skip to main content

declaration-property-value-disallowed-list

指定声明中不允许的属性和值对的列表。

¥Specify a list of disallowed property and value pairs within declarations.

a { text-transform: uppercase; }
/** ↑ ↑

* These properties and these values */

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

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

选项

¥Options

Object<string, Array<string>>

{ "unprefixed-property-name": ["array", "of", "values", "/regex/"] }

您可以为属性名称指定正则表达式,例如 { "/^animation/": [] }

¥You can specify a regex for a property name, such as { "/^animation/": [] }.

值也是如此。请记住,正则表达式值与声明的整个值匹配,而不是与声明的特定部分匹配。例如,像 "10px solid rgba( 255 , 0 , 0 , 0.5 )" 这样的值不会匹配 "/^solid/"(注意行边界的开头),但会匹配 "/\\s+solid\\s+/""/\\bsolid\\b/"

¥The same goes for values. Keep in mind that a regular expression value is matched against the entire value of the declaration, not specific parts of it. For example, a value like "10px solid rgba( 255 , 0 , 0 , 0.5 )" will not match "/^solid/" (notice beginning of the line boundary) but will match "/\\s+solid\\s+/" or "/\\bsolid\\b/".

请小心正则表达式匹配,不要意外考虑带引号的字符串值和 url() 参数。例如,"/red/" 将匹配 "1px dotted red""\"foo\"""white url(/mysite.com/red.png)" 等值。

¥Be careful with regex matching not to accidentally consider quoted string values and url() arguments. For example, "/red/" will match value such as "1px dotted red" as well as "\"foo\"" and "white url(/mysite.com/red.png)".

鉴于:

¥Given:

{
"declaration-property-value-disallowed-list": {
"transform": ["/scale3d/", "/rotate3d/", "/translate3d/"],
"position": ["fixed"],
"color": ["/^green/"],
"/^animation/": ["/ease/"]
}
}

以下模式被视为问题:

¥The following patterns are considered problems:

a { position: fixed; }
a { transform: scale3d(1, 2, 3); }
a { -webkit-transform: scale3d(1, 2, 3); }
a { color: green; }
a { animation: foo 2s ease-in-out; }
a { animation-timing-function: ease-in-out; }
a { -webkit-animation-timing-function: ease-in-out; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { position: relative; }
a { transform: scale(2); }
a { -webkit-transform: scale(2); }
a { color: lightgreen; }
a { animation: foo 2s linear; }
a { animation-timing-function: linear; }
a { -webkit-animation-timing-function: linear; }