noCompareNegZero
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/suspicious/noCompareNegZero¥Diagnostic Category:
lint/suspicious/noCompareNegZero -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则包含 safe 修复程序。
¥This rule has a safe fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
no-compare-neg-zero相同¥Same as
no-compare-neg-zero
-
¥How to configure
{ "linter": { "rules": { "suspicious": { "noCompareNegZero": "error" } } }}¥Description
禁止与 -0 进行比较
¥Disallow comparing against -0
¥Examples
¥Invalid
(1 >= -0)code-block.js:1:2 lint/suspicious/noCompareNegZero FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not use the >= operator to compare against -0.
> 1 │ (1 >= -0)
│ ^^^^^^^
2 │
ℹ Safe fix: Replace -0 with 0
1 │ (1·>=·-0)
│ -
¥Valid
(1 >= 0)¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号