Skip to content

selector-max-type

Reports a selector with more type selectors than the max option.

A selector made of many element names (div ul li a) is tied to the markup and breaks when an element is wrapped or changed. A limit pushes the styling to classes.

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

Suppress one line with sudsy-disable-next-line selector-max-type 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-type full