Skip to main content

noCompareNegZero

Disallow comparing against -0

Examples

Invalid

(1 >= -0)
warning[noCompareNegZero]: Do not use the >= operator to compare against -0.
   noCompareNegZero.js:1:2
  
1  (1 >= -0)
    -------

Safe fix: Replace -0 with 0
    | @@ -1 +1 @@
0   | - (1 >= -0)
  0 | + (1 >= 0)

Valid

(1 >= 0)