selector-max-compound-selectors
What it does
Section titled “What it does”Reports a selector with more compound selectors (parts between combinators) than the max option.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”.a.b.c, #x #y, a b c d, [p][q], * *, a:hover:focus { color: red }....i {...Configuration
Section titled “Configuration”css: lint: rules: selector-max-compound-selectors: level: warn # off (default), warn, error options: max: 3less: lint: rules: selector-max-compound-selectors: level: warn # off (default), warn, error options: max: 3scss: 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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | selector-max-compound-selectors |
full |