declaration-property-unit-disallowed-list
Specify a list of disallowed property and unit pairs within declarations.
a { width: 100px; }/** ↑ ↑ * These properties and these units */Use this rule to enforce a convention. For example, disallow:
pxforfont-size, so that text scales with your users’ settingssfor/^(transition|animation)/, so that every duration is inms
This rule supports 2 message arguments: the property name and the disallowed unit.
Options
Section titled “Options”Object<string, Array<string>>
Section titled “Object<string, Array<string>>”{ "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"], "/^(-webkit-)?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; }