Skip to content

selector-max-pseudo-class

Reports a selector with more pseudo-classes than the max option.

Each pseudo-class adds the specificity of a class and a state that must hold, so a long chain such as a:hover:focus:active is hard to override and hard to read. A limit keeps selectors simple.

Reported
.a.b.c, #x #y, a b c d, [p][q], * *, a:hover:focus { color: red }
...
.i {
...
css:
lint:
rules:
selector-max-pseudo-class:
level: warn # off (default), warn, error
options:
max: 0
less:
lint:
rules:
selector-max-pseudo-class:
level: warn # off (default), warn, error
options:
max: 0
scss:
lint:
rules:
selector-max-pseudo-class:
level: warn # off (default), warn, error
options:
max: 0
Option Type Default Description
max int 0 The most pseudo-classes a selector may have.

Suppress one line with sudsy-disable-next-line selector-max-pseudo-class in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint selector-max-pseudo-class full