Fix: prefer-numeric-literals doesn't check types of literal arguments #12655
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix
This PR can produce only fewer warnings in
From the documentation:
This PR fixes the following:
It did check if it's a
This probably didn't cause some notable problems, but it isn't by the spec (which is explicit about the first argument), and it might be unwanted in some cases.
/* eslint prefer-numeric-literals: error */ parseInt(1e8, 2); // fixed to 0b100000000;
The only check was whether the literal's
It's changed now to target only
Bigint radix argument causes ESLint to crash when the rule tries to evaluate the expression:
/* eslint prefer-numeric-literals: error */ parseInt('11', 2n); // TypeError: Cannot convert a BigInt value to a number.
What changes did you make? (Give an overview)
The rule now targets only
Also, converted objects used as maps to
Is there anything you'd like reviewers to focus on?