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 */

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

Options

Object<string, Array<string>>

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

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

Given:

{
"declaration-property-unit-disallowed-list": {
"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; }