noUnknownUnit
¥Summary
-
规则生效日期:
v1.8.0¥Rule available since:
v1.8.0 -
诊断类别:
lint/correctness/noUnknownUnit¥Diagnostic Category:
lint/correctness/noUnknownUnit -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
unit-no-unknown相同¥Same as
unit-no-unknown
-
¥How to configure
{ "linter": { "rules": { "correctness": { "noUnknownUnit": "error" } } }}¥Description
禁止未知的 CSS 单位。
¥Disallow unknown CSS units.
有关已知 CSS 单元的详细信息,请参阅 MDN web 文档。
¥For details on known CSS units, see the MDN web docs.
¥Examples
¥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.
¥Valid
a { width: 10px;}a { width: 10Px;}a { width: 10pX;}a { width: calc(10px + 10px);}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号