Nucleus handler tools › Docs › Checks

A number too precise for JavaScript

Warningno-loss-of-precisionA general JavaScript mistake (ESLint's no-loss-of-precision) · Probably wrong: Nucleus runs it, but not the way you meant.

Why it matters

JavaScript numbers can't hold this value exactly: it is silently rounded.

Example

✗ Wrong

var n = 9007199254740993;

✓ Right

var n = "9007199254740993";

How to fix it

Keep a value that big as text.

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-loss-of-precision": "off" } in your settings. Notepad++: Plugins › Nucleus Co-op handlers › Settings. Command line: ncdev lint --rule no-loss-of-precision=off. Other editors: the lint.rules setting of ncdev lsp.

Is this right? Tell us what's wrong
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop