selector-max-class
Limit the number of classes in a selector.
div .foo.bar[data-val] > a.baz {}/* ↑ ↑ ↑ ↑ ↑ ↑ 1 2 3 -- this selector contains three classes */Use this rule to enforce a convention. For example, limit selectors to 2 classes, so that selectors stay readable.
Each selector in a selector list is evaluated separately.
This rule supports 2 message arguments: the selector and the configured maximum.
Options
Section titled “Options”number
Section titled “number”Specify a maximum classes allowed.
Given:
{ "selector-max-class": 2}The following patterns are considered problems:
.foo.bar.baz {}The following patterns are not considered problems:
div {}.foo .bar {}