rule-selector-property-disallowed-list
Specify a list of disallowed properties for selectors within rules.
a { color: red; }
/** ↑ ↑
* Selector and property name */
The message
secondary option can accept the arguments of this rule.
Options
object
: { "selector": ["array", "of", "properties", "/regex/", /regex/]|"property"|"/regex/"|/regex/
If a selector name is surrounded with "/"
(e.g. "/anchor/"
), it is interpreted as a regular expression. This allows, for example, easy targeting of all the potential anchors: /anchor/
will match .anchor
, [data-anchor]
, etc.
The same goes for properties. Keep in mind that a regular expression value is matched against the entire property name, not specific parts of it. For example, a value like "animation-duration"
will not match "/^duration/"
(notice beginning of the line boundary) but will match "/duration/"
.
Given:
{
"a": ["color", "/margin/"],
"/foo/": "/size/"
}
The following patterns are considered problems:
a { color: red; }
a { margin-top: 0px; }
html[data-foo] { font-size: 1px; }
The following patterns are not considered problems:
a { background: red; }
a { padding-top: 0px; }
html[data-foo] { color: red; }
Optional secondary options
ignore: ["keyframe-selectors"]
Ignore keyframe selectors.
Given:
[{ "/^[a-z]+$/": ["opacity"] }, { "ignore": ["keyframe-selectors"] }]
The following pattern is not considered a problem:
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}