Skip to content

selector-max-compound-selectors

Reports a selector with more compound selectors (parts between combinators) than the max option.

A selector with many compound parts describes a long path through the markup. It breaks when the markup changes and has to be matched from right to left on every element. A limit keeps it shallow.

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

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