Skip to content

Commit afa4f37

Browse files
Trotttargos
authored andcommittedJan 14, 2022
tools: enable ESLint no-loss-of-precision rule
PR-URL: #41463 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]>
1 parent c9a4603 commit afa4f37

File tree

5 files changed

+6
-0
lines changed

5 files changed

+6
-0
lines changed
 

‎.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ module.exports = {
201201
'no-invalid-regexp': 'error',
202202
'no-irregular-whitespace': 'error',
203203
'no-lonely-if': 'error',
204+
'no-loss-of-precision': 'error',
204205
'no-misleading-character-class': 'error',
205206
'no-mixed-requires': 'error',
206207
'no-mixed-spaces-and-tabs': 'error',

‎test/js-native-api/test_number/test.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ testNumber(-1233);
1919
testNumber(986583);
2020
testNumber(-976675);
2121

22+
/* eslint-disable no-loss-of-precision */
2223
testNumber(
2324
98765432213456789876546896323445679887645323232436587988766545658);
2425
testNumber(
2526
-4350987086545760976737453646576078997096876957864353245245769809);
27+
/* eslint-enable no-loss-of-precision */
2628
testNumber(Number.MIN_SAFE_INTEGER);
2729
testNumber(Number.MAX_SAFE_INTEGER);
2830
testNumber(Number.MAX_SAFE_INTEGER + 10);

‎test/parallel/test-buffer-readdouble.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ assert.strictEqual(buffer.readDoubleLE(0), 1.0000000000000004);
3535
buffer[0] = 1;
3636
buffer[6] = 0;
3737
buffer[7] = 0;
38+
// eslint-disable-next-line no-loss-of-precision
3839
assert.strictEqual(buffer.readDoubleBE(0), 7.291122019556398e-304);
3940
assert.strictEqual(buffer.readDoubleLE(0), 5e-324);
4041

‎test/parallel/test-util-format.js

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ assert.strictEqual(
8585

8686
assert.strictEqual(
8787
util.format(
88+
// eslint-disable-next-line no-loss-of-precision
8889
'%d %s %i', 118059162071741130342, 118059162071741130342, 123_123_123),
8990
'118_059_162_071_741_140_000 118_059_162_071_741_140_000 123_123_123'
9091
);

‎test/parallel/test-util-inspect.js

+1
Original file line numberDiff line numberDiff line change
@@ -3187,6 +3187,7 @@ assert.strictEqual(
31873187
util.inspect.defaultOptions.numericSeparator = true;
31883188

31893189
assert.strictEqual(
3190+
// eslint-disable-next-line no-loss-of-precision
31903191
util.inspect(1234567891234567891234),
31913192
'1.234567891234568e+21'
31923193
);

0 commit comments

Comments
 (0)
Please sign in to comment.