Skip to content

eslint/no-loss-of-precision Correctness

This rule is turned on by default.

What it does

Disallow precision loss of number literal

Why is this bad?

It can lead to unexpected results in certain situations For example, when performing mathematical operations

Example

javascript
var x = 2e999;

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny no-loss-of-precision
json
{
  "rules": {
    "no-loss-of-precision": "error"
  }
}

References

Released under the MIT License.