Nucleus handler tools β€Ί Docs β€Ί Checks

A comparison with -0

Infono-compare-neg-zeroA general JavaScript mistake (ESLint's no-compare-neg-zero) Β· Worth knowing: it works, with a catch.

Why it matters

x === -0 is also true for 0. Use 1 / x === -Infinity if you really need to tell them apart.

Example

βœ— Wrong

var x = 0;
if (x === -0) {
}

βœ“ Right

var x = 0;
if (x === 0) {
}

How to fix it

Compare with 0, or use 1 / x === -Infinity if the sign matters.

Turn it off, or change how it shows

Each check can be shown as an error, warning, info or hint, or turned off. VS Code: "splitscreenme.lint.rules": { "no-compare-neg-zero": "off" } in your settings. Notepad++: Plugins β€Ί Nucleus Co-op handlers β€Ί Settings. Command line: ncdev lint --rule no-compare-neg-zero=off. Other editors: the lint.rules setting of ncdev lsp.

Is this right?
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop