unit-no-unknown
What it does
Section titled “What it does”Reports a unit that is not a CSS unit, in values and @media preludes. x is accepted only in image-set(), image-resolution and resolution media features. The ignore option lists more names.
Why it matters
Section titled “Why it matters”An unknown unit (1foo, or 10pxx by a typo) makes the declaration invalid, and the browser drops it without an error.
To fix, correct the unit.
Example
Section titled “Example”...@media (min-resolution: 2x) {}a { colour: red; width: 1foo; height: 2x; -webkit-foo: 1; --x: 1foo; width: foo(1) bar(2) var(--a) calc(1px + 2px) }a { background: image-set(url("a.png") 1x); margin: 1PX 2% 1e3em }...Configuration
Section titled “Configuration”css: lint: rules: unit-no-unknown: level: warn # off (default), warn, error options: ignore: []less: lint: rules: unit-no-unknown: level: warn # off (default), warn, error options: ignore: []scss: lint: rules: unit-no-unknown: level: warn # off (default), warn, error options: ignore: []| Option | Type | Default | Description |
|---|---|---|---|
ignore |
list | [] |
Names left out: names, or /regex/. |
Suppress one line with sudsy-disable-next-line unit-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 | unit-no-unknown |
full |