Skip to content

Commit ea789c7

Browse files
authored
fix: no-loss-of-precision false positive with uppercase exponent (#20032)
1 parent b8875f6 commit ea789c7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/rules/no-loss-of-precision.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ module.exports = {
189189
* @returns {boolean} true if they do not match
190190
*/
191191
function baseTenLosesPrecision(node) {
192-
const rawNumber = getRaw(node);
192+
const rawNumber = getRaw(node).toLowerCase();
193193

194194
/*
195195
* If trailing zeros equal the exponent, this is a valid representation

tests/lib/rules/no-loss-of-precision.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ ruleTester.run("no-loss-of-precision", rule, {
5252
"var x = 9.00e2",
5353
"var x = 9.000e3",
5454
"var x = 9.0000000000e10",
55+
"var x = 9.00E2",
56+
"var x = 9.000E3",
57+
"var x = 9.0000000000E10",
5558
"var x = 019.5",
5659
"var x = 0195",
5760
"var x = 0e5",

0 commit comments

Comments
 (0)