noCompareNegZero
诊断类别:lint/suspicious/noCompareNegZero
¥Diagnostic Category: lint/suspicious/noCompareNegZero
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
no-compare-neg-zero
¥Same as:
no-compare-neg-zero
禁止与 -0
进行比较
¥Disallow comparing against -0
¥Examples
¥Invalid
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
¥Related links