Skip to content

noCompareNegZero

¥Summary

¥How to configure

biome.json
{
"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