rule-selector-property-disallowed-list
Specify a list of disallowed properties for selectors within rules.
a { color: red; }/** ↑ ↑ * Selector and property name */Use this rule to enforce a convention. For example, disallow:
/^margin/on/^\.c-/, so that components don’t set their own outer spacing/^(margin|padding)/on/^(h[1-6]|p)$/to limit element styles to typography
This rule supports 2 message arguments: the selector and the disallowed property.
Options
Section titled “Options”Object<string, Array<string>>
Section titled “Object<string, Array<string>>”{ "selector": ["array", "of", "properties", "/regex/"] }You can specify a regex for a selector, such as { "/foo-/": [] }.
Given:
{ "rule-selector-property-disallowed-list": { "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
Section titled “Optional secondary options”ignore
Section titled “ignore”{ "ignore": ["array", "of", "options"] }"keyframe-selectors"
Section titled “"keyframe-selectors"”Ignore keyframe selectors.
Given:
{ "rule-selector-property-disallowed-list": [ { "/^[a-z]+$/": ["opacity"] }, { "ignore": ["keyframe-selectors"] } ]}The following pattern is not considered a problem:
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; }}