selector-max-combinators
Limit the number of combinators in a selector.
a > b + c ~ d e { color: pink; }/** ↑ ↑ ↑ ↑ * These are combinators */Use this rule to enforce a convention. For example, limit selectors to 1 combinator, so that styles can’t reach deep into the markup.
Each selector in a selector list is evaluated separately.
This rule supports 2 message arguments: the selector and the configured maximum.
Options
Section titled “Options”number
Section titled “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 {}