Skip to main content

declaration-property-unit-disallowed-list

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

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

a { width: 100px; }
/** ↑ ↑

* These properties and these units */

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

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

选项

¥Options

object{ "unprefixed-property-name": ["array", "of", "units"]|"unit" }

如果属性名称被 "/" 包围(例如 "/^animation/"),则它被解释为正则表达式。例如,这可以轻松定位简写:/^animation/ 将匹配 animationanimation-durationanimation-timing-function 等。

¥If a property name is surrounded with "/" (e.g. "/^animation/"), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: /^animation/ will match animation, animation-duration, animation-timing-function, etc.

鉴于:

¥Given:

{
"font-size": ["em", "px"],
"/^animation/": "s"
}

以下模式被视为问题:

¥The following patterns are considered problems:

a { font-size: 1em; }
a { animation: animation-name 5s ease; }
a { -webkit-animation: animation-name 5s ease; }
a { animation-duration: 5s; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { font-size: 1.2rem; }
a { height: 100px; }
a { animation: animation-name 500ms ease; }
a { -webkit-animation: animation-name 500ms ease; }
a { animation-duration: 500ms; }