Skip to main content

selector-no-invalid

Disallow invalid selectors.

a ) b {}
/* ↑
* Selectors like this */

This rule considers selectors defined within the CSS specifications, up to and including Editor's Drafts, to be valid.

warning

This rule is only appropriate for CSS. You should not turn it on for CSS-like languages, such as SCSS or Less.

This rule supports 2 message arguments: the selector and the reason it is invalid.

Options

true

{
"selector-no-invalid": true
}

The following patterns are considered problems:

a ) b {}
:nth-child(2n+) {}
[0foo] {}
:dir(foo) {}

The following patterns are not considered problems:

a b {}
:nth-child(2n+1) {}
[foo] {}
:dir(ltr) {}