length-zero-no-unit
What it does
Section titled “What it does”Reports a zero length written with a unit (0px). Dimensions that are not lengths (0s, 0deg), and anything inside a function, are not reported.
Why it matters
Section titled “Why it matters”Zero is the same in every length unit, so the unit says nothing and costs bytes. Inside calc() and the like the unit may be needed, so those are left alone, as are times and angles, where a unit is required.
To fix, write 0.
Example
Section titled “Example”...@import "b.css";a { margin: 0px 0.0em 0; transition: 0s; width: calc(0px + 1px); --x: 0px;...Configuration
Section titled “Configuration”css: lint: rules: length-zero-no-unit: warn # off (default), warn, errorless: lint: rules: length-zero-no-unit: warn # off (default), warn, errorscss: lint: rules: length-zero-no-unit: warn # off (default), warn, errorEnabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line length-zero-no-unit 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 | length-zero-no-unit |
full |