GeezerVison is showing github.com — tools: enable ESLint no-loss-of-precision rule · nodejs/node@afa4f37
File tree
Expand file treeCollapse file tree
Open diff view settings
js-native-api/test_number
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .eslintrc.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -201,6 +201,7 @@ module.exports = { |
201 | 201 | 'no-invalid-regexp': 'error', |
202 | 202 | 'no-irregular-whitespace': 'error', |
203 | 203 | 'no-lonely-if': 'error', |
| 204 | + 'no-loss-of-precision': 'error', |
204 | 205 | 'no-misleading-character-class': 'error', |
205 | 206 | 'no-mixed-requires': 'error', |
206 | 207 | 'no-mixed-spaces-and-tabs': 'error', |
|
Collapse file
Copy file name to clipboardExpand all lines: test/js-native-api/test_number/test.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,10 +19,12 @@ testNumber(-1233); |
19 | 19 | testNumber(986583); |
20 | 20 | testNumber(-976675); |
21 | 21 |
|
| 22 | +/* eslint-disable no-loss-of-precision */ |
22 | 23 | testNumber( |
23 | 24 | 98765432213456789876546896323445679887645323232436587988766545658); |
24 | 25 | testNumber( |
25 | 26 | -4350987086545760976737453646576078997096876957864353245245769809); |
| 27 | +/* eslint-enable no-loss-of-precision */ |
26 | 28 | testNumber(Number.MIN_SAFE_INTEGER); |
27 | 29 | testNumber(Number.MAX_SAFE_INTEGER); |
28 | 30 | testNumber(Number.MAX_SAFE_INTEGER + 10); |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-buffer-readdouble.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,6 +35,7 @@ assert.strictEqual(buffer.readDoubleLE(0), 1.0000000000000004); |
35 | 35 | buffer[0] = 1; |
36 | 36 | buffer[6] = 0; |
37 | 37 | buffer[7] = 0; |
| 38 | +// eslint-disable-next-line no-loss-of-precision |
38 | 39 | assert.strictEqual(buffer.readDoubleBE(0), 7.291122019556398e-304); |
39 | 40 | assert.strictEqual(buffer.readDoubleLE(0), 5e-324); |
40 | 41 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-util-format.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -85,6 +85,7 @@ assert.strictEqual( |
85 | 85 |
|
86 | 86 | assert.strictEqual( |
87 | 87 | util.format( |
| 88 | + // eslint-disable-next-line no-loss-of-precision |
88 | 89 | '%d %s %i', 118059162071741130342, 118059162071741130342, 123_123_123), |
89 | 90 | '118_059_162_071_741_140_000 118_059_162_071_741_140_000 123_123_123' |
90 | 91 | ); |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3187,6 +3187,7 @@ assert.strictEqual( |
3187 | 3187 | util.inspect.defaultOptions.numericSeparator = true; |
3188 | 3188 |
|
3189 | 3189 | assert.strictEqual( |
| 3190 | + // eslint-disable-next-line no-loss-of-precision |
3190 | 3191 | util.inspect(1234567891234567891234), |
3191 | 3192 | '1.234567891234568e+21' |
3192 | 3193 | ); |
|