selector-max-combinators
What it does
Section titled “What it does”Reports a selector with more combinators than the max option; a space between two compound selectors counts.
Why it matters
Section titled “Why it matters”Every combinator ties the rule to one more level of the markup, so deep selectors break when the markup changes and are slow to read and match. A limit keeps selectors 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-combinators: level: warn # off (default), warn, error options: max: 2less: lint: rules: selector-max-combinators: level: warn # off (default), warn, error options: max: 2scss: lint: rules: selector-max-combinators: level: warn # off (default), warn, error options: max: 2| Option | Type | Default | Description |
|---|---|---|---|
max |
int | 2 |
The most combinators a selector may have. |
Suppress one line with sudsy-disable-next-line selector-max-combinators in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| stylelint | selector-max-combinators |
partial | differs from stylelint on :nth-child(An+B of S) selector lists |