max-nesting-depth
What it does
Section titled “What it does”Reports a rule or at-rule nested inside more rules or at-rules than the max option.
Why it matters
Section titled “Why it matters”Nested rules multiply: three levels of nesting give a selector that is the product of three, with high specificity and tied to the markup. Deep nesting also makes the file hard to read. A limit keeps nesting shallow.
Example
Section titled “Example”....d { .e { .f { .g { color: red } } } }....i { color: red; margin: 0;...Configuration
Section titled “Configuration”css: lint: rules: max-nesting-depth: level: warn # off (default), warn, error options: max: 3less: lint: rules: max-nesting-depth: level: warn # off (default), warn, error options: max: 3scss: lint: rules: max-nesting-depth: level: warn # off (default), warn, error options: max: 3| Option | Type | Default | Description |
|---|---|---|---|
max |
int | 3 |
How deep rules may nest. |
Suppress one line with sudsy-disable-next-line max-nesting-depth 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 | max-nesting-depth |
full |