hue-degree-notation
What it does
Section titled “What it does”Reports the hue of hsl(), hsla(), hwb(), lch() or oklch() written as a bare number (120), on the function name. A hue with a unit (120deg) is not reported.
Why it matters
Section titled “Why it matters”A hue is an angle, and without a unit 120 does not say if it is degrees, radians or turns; CSS reads it as degrees, but the next reader has to know that. Writing 120deg makes the value self-describing and matches the other angle properties.
To fix, add deg to the number.
Example
Section titled “Example”...e { color: hsl(120deg 50% 50%); }f { color: hsl(120, 50%, 50%); }g { color: hsla(120 50% 50% / 50%); }h { color: rgb(0 0 0 / 50%); }i { color: hsl(120 50% 50% / 0.5); }j { color: rgb(var(--x), 0.5); }...l { color: oklch(50% 0.2 120); }m { color: oklch(50% 0.2 120deg / 50%); }n { color: rgb(0 0 0); }...Configuration
Section titled “Configuration”css: lint: rules: hue-degree-notation: warn # off (default), warn, errorless: lint: rules: hue-degree-notation: warn # off (default), warn, errorscss: lint: rules: hue-degree-notation: warn # off (default), warn, errorEnabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line hue-degree-notation 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 | hue-degree-notation |
full |