A value is compared with -0, which comparisons do not tell from 0

tx0/ts:negative-zero-comparisondefaultwarningbug

What it finds

x === -0: comparisons do not tell -0 from +0, so this is also true when x is 0. Object.is(x, -0) is the test for negative zero.

Every comparison operator is checked, since x < -0 and x < 0 mean the same too.

From the rule's source, negative_zero_comparison.rs.

Example from the rule's tests
function check(value: number) {  if (value === -0) {tx0 reports: value === -0 treats -0 and 0 alike    return 1;  }  if (-0.0 < value) {tx0 reports: -0.0 < value treats -0 and 0 alike    return 2;  }  return Object.is(value, -0) || value === 0 || value === -1;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:negative-zero-comparison" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:negative-zero-comparison] reason="..."

tx0 explain tx0/ts:negative-zero-comparison shows the same in the terminal. Found a false positive? Report it.