Skip to main content

property-allowed-list

Specify a list of allowed properties.

a { color: red; }
/** ↑
* This property */

This rule ignores preprocessor variables (e.g. $sass, @less).

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

Options

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

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/", "--foo"]

The following patterns are considered problems:

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

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: red; }
a { background-color: red; }
a { --foo: red; }