Skip to content

unit-no-unknown

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.

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.

Reported
...
@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 }
...
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.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint unit-no-unknown full