noUnknownUnit
Summary
Section titled “Summary”- Rule available since:
v1.8.0 - Diagnostic Category:
lint/correctness/noUnknownUnit - This rule is recommended, which means is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
- Same as
stylelint/unit-no-unknown
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "correctness": { "noUnknownUnit": "error" } } }}Description
Section titled “Description”Disallow unknown CSS units.
For details on known CSS units, see the MDN web docs.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”a { width: 10pixels;}code-block.css:2:12 lint/correctness/noUnknownUnit ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected unknown unit: pixels
1 │ a {
> 2 │ width: 10pixels;
│ ^^^^^^
3 │ }
4 │
ℹ See MDN web docs for more details.
ℹ Use a known unit instead, such as:
- px
- em
- rem
- etc.
a { width: calc(10px + 10pixels);}code-block.css:2:24 lint/correctness/noUnknownUnit ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected unknown unit: pixels
1 │ a {
> 2 │ width: calc(10px + 10pixels);
│ ^^^^^^
3 │ }
4 │
ℹ See MDN web docs for more details.
ℹ Use a known unit instead, such as:
- px
- em
- rem
- etc.
a { width: 10px;}a { width: 10Px;}a { width: 10pX;}a { width: calc(10px + 10px);}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.