selector-pseudo-class-no-unknown
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: offcss/stylelint-recommended
What it does
Section titled “What it does”Reports a pseudo-class that is not a CSS one. Vendor-prefixed ones are not reported, and the -webkit-scrollbar pseudo-classes count after those pseudo-elements.
Why it matters
Section titled “Why it matters”A selector with an unknown pseudo-class is invalid, and the browser drops the whole rule, not only the pseudo-class. A typo (:hovr) therefore removes the style for every selector in the list.
To fix, correct the name.
Example
Section titled “Example”...@media (min-resolution: 2x) {}...a { background: image-set(url("a.png") 1x); margin: 1PX 2% 1e3em }a:foo, a:hover, a::foo, a::before, a:before, a:-moz-foo, a:nth-child(even), a:lang(en), a:not(:bar) {}...::-webkit-scrollbar-thumb:horizontal {}a:horizontal {}@page :first { margin: 1cm }@font-face { src: url("a");...Configuration
Section titled “Configuration”css: lint: rules: selector-pseudo-class-no-unknown: level: warn # off (default), warn, error options: ignore: []less: lint: rules: selector-pseudo-class-no-unknown: level: warn # off (default), warn, error options: ignore: []scss: lint: rules: selector-pseudo-class-no-unknown: level: warn # off (default), warn, error options: ignore: []| Option | Type | Default | Description |
|---|---|---|---|
ignore |
list | [] |
Names left out: names, or /regex/. |
Enabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line selector-pseudo-class-no-unknown 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-pseudo-class-no-unknown |
full |