Skip to main content

selector-max-combinators

Limit the number of combinators in a selector.

  a > b + c ~ d e { color: pink; }
/** ↑ ↑ ↑ ↑
* These are combinators */

Each selector in a selector list is evaluated separately.

note

In versions prior to 17.0.0, this rule would evaluate functional pseudo-classes separately, such as :not() and :is(), and resolve nested selectors (in a nonstandard way) before counting.

Options

number

Specify a maximum combinators selectors allowed.

Given:

{
"selector-max-combinators": 2
}

The following patterns are considered problems:

a b ~ c + d {}
a b ~ c + d > e {}

The following patterns are not considered problems:

a {}
a b {}
a b ~ c {}