selector-max-pseudo-class
Limit the number of pseudo-classes in a selector.
.foo .bar:first-child:hover {}/* ↑ ↑ ↑ ↑ 1 2 -- this selector contains two pseudo-classes */Use this rule to enforce a convention. For example, limit selectors to 2 pseudo-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 pseudo-classes allowed.
Given:
{ "selector-max-pseudo-class": 1}The following patterns are considered problems:
a:first-child:focus {}.foo .bar:first-child:hover {}The following patterns are not considered problems:
a {}a:first-child {}.foo .bar:first-child {}