selector-combinator-allowed-list
What it does
Section titled “What it does”Reports a combinator (>, +, ~, or a space for the descendant combinator) that is not in the list option. An empty list allows everything.
Why it matters
Section titled “Why it matters”A project can limit which relations between elements its selectors may use, for example to keep selectors short and fast to match. The rule is a policy: with no list it reports nothing.
Example
Section titled “Example”With this configuration:
property-allowed-list: { level: warn, options: { list: [color, "/^wid/"] } }unit-allowed-list: { level: warn, options: { list: [px, em] } }function-allowed-list: { level: warn, options: { list: [var] } }at-rule-allowed-list: { level: warn, options: { list: [media] } }media-feature-name-allowed-list: { level: warn, options: { list: [max-width] } }selector-pseudo-class-allowed-list: { level: warn, options: { list: [focus] } }selector-pseudo-element-allowed-list: { level: warn, options: { list: [after] } }selector-combinator-allowed-list: { level: warn, options: { list: [" "] } }selector-attribute-operator-allowed-list: { level: warn, options: { list: ["="] } }... a:hover::before > b { color: red; float: left; width: calc(1px + 2em); height: 1rem }}Configuration
Section titled “Configuration”css: lint: rules: selector-combinator-allowed-list: level: warn # off (default), warn, error options: list: []less: lint: rules: selector-combinator-allowed-list: level: warn # off (default), warn, error options: list: []scss: lint: rules: selector-combinator-allowed-list: level: warn # off (default), warn, error options: list: []| Option | Type | Default | Description |
|---|---|---|---|
list |
list | [] |
The allowed combinators. |
Suppress one line with sudsy-disable-next-line selector-combinator-allowed-list 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-combinator-allowed-list |
full |