From d62d8407e7f51f2f9f6bc1798e4437a32f28dadf Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Thu, 29 Apr 2021 17:35:52 +0800 Subject: [PATCH 01/11] Rewrite tests --- test/no-zero-fractions.mjs | 100 ++--------- test/snapshots/no-zero-fractions.mjs.md | 208 ++++++++++++++++++++++ test/snapshots/no-zero-fractions.mjs.snap | Bin 251 -> 803 bytes 3 files changed, 222 insertions(+), 86 deletions(-) diff --git a/test/no-zero-fractions.mjs b/test/no-zero-fractions.mjs index 37ba82f2c1..7dfd29b3f8 100644 --- a/test/no-zero-fractions.mjs +++ b/test/no-zero-fractions.mjs @@ -2,16 +2,7 @@ import {getTester} from './utils/test.mjs'; const {test} = getTester(import.meta); -const MESSAGE_ZERO_FRACTION = 'zero-fraction'; -const MESSAGE_DANGLING_DOT = 'dangling-dot'; -const errorZeroFraction = { - messageId: MESSAGE_ZERO_FRACTION -}; -const errorDanglingDot = { - messageId: MESSAGE_DANGLING_DOT -}; - -test({ +test.snapshot({ valid: [ 'const foo = "123.1000"', 'foo("123.1000")', @@ -24,84 +15,21 @@ test({ 'const foo = 123123123.4', 'const foo = 1e3' ], - invalid: [ - { - code: 'const foo = 1.0', - output: 'const foo = 1', - errors: [errorZeroFraction] - }, - { - code: 'const foo = 1.0 + 1', - output: 'const foo = 1 + 1', - errors: [errorZeroFraction] - }, - { - code: 'foo(1.0 + 1)', - output: 'foo(1 + 1)', - errors: [errorZeroFraction] - }, - { - code: 'const foo = 1.00', - output: 'const foo = 1', - errors: [errorZeroFraction] - }, - { - code: 'const foo = 1.00000', - output: 'const foo = 1', - errors: [errorZeroFraction] - }, - { - code: 'const foo = -1.0', - output: 'const foo = -1', - errors: [errorZeroFraction] - }, - { - code: 'const foo = 123123123.0', - output: 'const foo = 123123123', - errors: [errorZeroFraction] - }, - { - code: 'const foo = 123.11100000000', - output: 'const foo = 123.111', - errors: [errorZeroFraction] - }, - { - code: 'const foo = 1.', - output: 'const foo = 1', - errors: [errorDanglingDot] - }, - { - code: 'const foo = +1.', - output: 'const foo = +1', - errors: [errorDanglingDot] - }, - { - code: 'const foo = -1.', - output: 'const foo = -1', - errors: [errorDanglingDot] - }, - { - code: 'const foo = 1.e10', - output: 'const foo = 1e10', - errors: [errorDanglingDot] - }, - { - code: 'const foo = +1.e-10', - output: 'const foo = +1e-10', - errors: [errorDanglingDot] - }, - { - code: 'const foo = -1.e+10', - output: 'const foo = -1e+10', - errors: [errorDanglingDot] - } - ] -}); - -test.snapshot({ - valid: [], invalid: [ 'const foo = 1.0', + 'const foo = 1.0 + 1', + 'foo(1.0 + 1)', + 'const foo = 1.00', + 'const foo = 1.00000', + 'const foo = -1.0', + 'const foo = 123123123.0', + 'const foo = 123.11100000000', + 'const foo = 1.', + 'const foo = +1.', + 'const foo = -1.', + 'const foo = 1.e10', + 'const foo = +1.e-10', + 'const foo = -1.e+10', 'const foo = (1.).toString()' ] }); diff --git a/test/snapshots/no-zero-fractions.mjs.md b/test/snapshots/no-zero-fractions.mjs.md index dc65d2b38f..945fe1c9df 100644 --- a/test/snapshots/no-zero-fractions.mjs.md +++ b/test/snapshots/no-zero-fractions.mjs.md @@ -21,6 +21,214 @@ Generated by [AVA](https://avajs.dev). ` ## Invalid #2 + 1 | const foo = 1.0 + 1 + +> Output + + `␊ + 1 | const foo = 1 + 1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 1.0 + 1␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #3 + 1 | foo(1.0 + 1) + +> Output + + `␊ + 1 | foo(1 + 1)␊ + ` + +> Error 1/1 + + `␊ + > 1 | foo(1.0 + 1)␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #4 + 1 | const foo = 1.00 + +> Output + + `␊ + 1 | const foo = 1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 1.00␊ + | ^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #5 + 1 | const foo = 1.00000 + +> Output + + `␊ + 1 | const foo = 1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 1.00000␊ + | ^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #6 + 1 | const foo = -1.0 + +> Output + + `␊ + 1 | const foo = -1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = -1.0␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #7 + 1 | const foo = 123123123.0 + +> Output + + `␊ + 1 | const foo = 123123123␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 123123123.0␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #8 + 1 | const foo = 123.11100000000 + +> Output + + `␊ + 1 | const foo = 123.111␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 123.11100000000␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #9 + 1 | const foo = 1. + +> Output + + `␊ + 1 | const foo = 1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 1.␊ + | ^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #10 + 1 | const foo = +1. + +> Output + + `␊ + 1 | const foo = +1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = +1.␊ + | ^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #11 + 1 | const foo = -1. + +> Output + + `␊ + 1 | const foo = -1␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = -1.␊ + | ^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #12 + 1 | const foo = 1.e10 + +> Output + + `␊ + 1 | const foo = 1e10␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = 1.e10␊ + | ^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #13 + 1 | const foo = +1.e-10 + +> Output + + `␊ + 1 | const foo = +1e-10␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = +1.e-10␊ + | ^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #14 + 1 | const foo = -1.e+10 + +> Output + + `␊ + 1 | const foo = -1e+10␊ + ` + +> Error 1/1 + + `␊ + > 1 | const foo = -1.e+10␊ + | ^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #15 1 | const foo = (1.).toString() > Output diff --git a/test/snapshots/no-zero-fractions.mjs.snap b/test/snapshots/no-zero-fractions.mjs.snap index ca83dd3dd3a31250a1a3145780fc9396c927aa92..0433b4a1c6fd50c9d529ef5faa1376f72ec33408 100644 GIT binary patch literal 803 zcmV+;1Kj*URzVPCsA*i(ZCe zOQ5Bhw>fl9l-zNA_k7{kH8=cSn82cmP<#f6+wL_=HGfew@xJ5Lxk&rLekQQ!XDE(l zW?-0_;(uY^Bi|bKH~%juS1$u<1c}x|@lzn4d0u|Y-$k*y7Ym9O*!zb0Fo8w6Ss=Iw zh?i{q{`zQ{OXJ16vrUyJwr*hpi%x>#*FbzgFVlL$Q#q#c$71oH&c3&00*i{VLU0!l zp9qz=x6zc{lX%N2qh+&yF%wvH6BNs`0afhdwD9e>h}ROB&J+3BIfDr->IlV4fcUC{ z&tY|r_iUUgf_75p-`-~ei(Y|ZXLbgLnEPLBRLotm>Jl?@y*D}Ajl}nrJ!J_P@|BXpI2O>kd~jX zV5?xrg`y;w%MMeC9#EeGP!Ji!#VNSt=c$({loqEdBr2pN=B4Lk=A|p77iO6hQ$rKXpRWQ;s{-=t{~eP(%6E+$XL(N5X~)l*a8Hi&;Sash7Jlq zabs0#QNBW2QDSmQW_})CM-mZV5m@63r<=%hh!hrwXd9;L8XBOgi^bv^Z9_e0V~8BL}Z2#G07TRTmh3cuAm{)B@);ICKWxVBC&=`D%Nls5USEN>^U5Qu*MGMIU8Gs(lt!g zCMH7xlMGlPl`|B!6s%1|!K_W)f>{ZRGc*h}^-A)CONxL7XrQH_L@Z7MCM6UNRCFE@ hMRFMSB8RHQ4H3?W!%;Kft+0r94gl-hw;o*z003xsb8r9v literal 251 zcmVS&CzfEQJ9V1^S^b{~rf00000000B? zVqjokVrZ_edSae6_eijb!~Wjeo)Sz9AYcH+^MUy0$>z5^?~5GMynZM3s;$auCa~xs zC{|-+U|?oo2kT;FWe{Xk;!;pBRH#u%&d)0@QAo?rSFlykFx1p5$qz0m%FIjG(Bwi< zpU7p0MZF%11_dCfQ9uE4aSAT^dFmw!rNyZVi3%x+dFeSo#R@6;B?_5&3MCn-3VEfu zNvTD8sMd*Mah@Tnk}xbTGSoA`;)*ylS5&1I Date: Fri, 30 Apr 2021 14:04:55 +0800 Subject: [PATCH 02/11] Refactor --- rules/no-zero-fractions.js | 43 +++++++++++++------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index 2d198d0948..56cb16cb18 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -1,5 +1,6 @@ 'use strict'; const getDocumentationUrl = require('./utils/get-documentation-url'); +const {isNumber, parseNumber} = require('./utils/numeric'); const MESSAGE_ZERO_FRACTION = 'zero-fraction'; const MESSAGE_DANGLING_DOT = 'dangling-dot'; @@ -8,46 +9,32 @@ const messages = { [MESSAGE_DANGLING_DOT]: 'Don\'t use a dangling dot in the number.' }; -// Groups: -// 1. Integer part. -// 2. Dangling dot or dot with zeroes. -// 3. Dot with digits except last zeroes. -// 4. Scientific notation. -const RE_DANGLINGDOT_OR_ZERO_FRACTIONS = /^(?[+-]?\d*)(?:(?\.0*)|(?\.\d*[1-9])0+)(?e[+-]?\d+)?$/; +const format = text => { + // Legacy octal number `0777` and prefixed number `0o1234` can't has dot. + const {number, mark, sign, power} = parseNumber(text); + return { + hasDanglingDot: number.endsWith('.'), + formatted: number.replace(/[0_.]$/g, '') + mark + sign + power + }; +} const create = context => { return { Literal: node => { - if (typeof node.value !== 'number') { + const {raw} = node; + if (!isNumber(node) || !raw.includes('.')) { return; } - const match = RE_DANGLINGDOT_OR_ZERO_FRACTIONS.exec(node.raw); - if (match === null) { + const {hasDanglingDot, formatted} = format(raw); + if (formatted === raw) { return; } - const { - integerPart, - dotAndZeroes, - dotAndDigits, - scientificNotationSuffix - } = match.groups; - - const isDanglingDot = dotAndZeroes === '.'; - context.report({ node, - messageId: isDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, - fix: fixer => { - let wantedString = dotAndZeroes === undefined ? integerPart + dotAndDigits : integerPart; - - if (scientificNotationSuffix !== undefined) { - wantedString += scientificNotationSuffix; - } - - return fixer.replaceText(node, wantedString); - } + messageId: hasDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, + fix: fixer => fixer.replaceText(node, formatted) }); } }; From ec6402e6f2c55d1519b2ace4b3e845d995509b5f Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 14:33:58 +0800 Subject: [PATCH 03/11] Add tests --- rules/no-zero-fractions.js | 7 +- rules/utils/numeric.js | 2 +- test/no-zero-fractions.mjs | 32 +- test/snapshots/no-zero-fractions.mjs.md | 2304 +++++++++++++++++++++ test/snapshots/no-zero-fractions.mjs.snap | Bin 803 -> 5805 bytes 5 files changed, 2340 insertions(+), 5 deletions(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index 56cb16cb18..a687608cd6 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -1,6 +1,6 @@ 'use strict'; const getDocumentationUrl = require('./utils/get-documentation-url'); -const {isNumber, parseNumber} = require('./utils/numeric'); +const {isNumber, parseNumber, parseFloat} = require('./utils/numeric'); const MESSAGE_ZERO_FRACTION = 'zero-fraction'; const MESSAGE_DANGLING_DOT = 'dangling-dot'; @@ -12,9 +12,10 @@ const messages = { const format = text => { // Legacy octal number `0777` and prefixed number `0o1234` can't has dot. const {number, mark, sign, power} = parseNumber(text); + const {integer, dot, fractional} = parseFloat(number); return { - hasDanglingDot: number.endsWith('.'), - formatted: number.replace(/[0_.]$/g, '') + mark + sign + power + hasDanglingDot: !fractional, + formatted: integer + (dot + fractional).replace(/[0_.]+$/g, '') + mark + sign + power }; } diff --git a/rules/utils/numeric.js b/rules/utils/numeric.js index fce19afc97..3c48f6750d 100644 --- a/rules/utils/numeric.js +++ b/rules/utils/numeric.js @@ -28,7 +28,7 @@ function parseNumber(text) { mark = '', sign = '', power = '' - } = text.match(/^(?.*?)(?:(?e)(?[+-])?(?\d+))?$/i).groups; + } = text.match(/^(?.*?)(?:(?e)(?[+-])?(?.+))?$/i).groups; return {number, mark, sign, power}; } diff --git a/test/no-zero-fractions.mjs b/test/no-zero-fractions.mjs index 7dfd29b3f8..6e67068501 100644 --- a/test/no-zero-fractions.mjs +++ b/test/no-zero-fractions.mjs @@ -30,6 +30,36 @@ test.snapshot({ 'const foo = 1.e10', 'const foo = +1.e-10', 'const foo = -1.e+10', - 'const foo = (1.).toString()' + 'const foo = (1.).toString()', + ...[ + '123_000.', + '123_000.0', + '123_000.000', + '123_000.000_000', + '123_000.123_000', + '123_000.000_400' + ] + .flatMap(number => [ + number, + `${number}e1`, + `${number}e+1`, + `${number}e-1`, + `${number}e0`, + `${number}e+0`, + `${number}e-0`, + `${number}e10`, + `${number}e+10`, + `${number}e-10`, + `${number}E-10`, + `${number}E-10_10` + ]) + .flatMap(number => [ + `+${number}`, + `-${number}` + ]) + .flatMap(number => [ + `${number};` + ]) + ] }); diff --git a/test/snapshots/no-zero-fractions.mjs.md b/test/snapshots/no-zero-fractions.mjs.md index 945fe1c9df..1bf8b98107 100644 --- a/test/snapshots/no-zero-fractions.mjs.md +++ b/test/snapshots/no-zero-fractions.mjs.md @@ -243,3 +243,2307 @@ Generated by [AVA](https://avajs.dev). > 1 | const foo = (1.).toString()␊ | ^^ Don't use a dangling dot in the number.␊ ` + +## Invalid #16 + 1 | +123_000.; + +> Output + + `␊ + 1 | +123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.;␊ + | ^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #17 + 1 | -123_000.; + +> Output + + `␊ + 1 | -123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.;␊ + | ^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #18 + 1 | +123_000.e1; + +> Output + + `␊ + 1 | +123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e1;␊ + | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #19 + 1 | -123_000.e1; + +> Output + + `␊ + 1 | -123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e1;␊ + | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #20 + 1 | +123_000.e+1; + +> Output + + `␊ + 1 | +123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e+1;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #21 + 1 | -123_000.e+1; + +> Output + + `␊ + 1 | -123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e+1;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #22 + 1 | +123_000.e-1; + +> Output + + `␊ + 1 | +123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e-1;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #23 + 1 | -123_000.e-1; + +> Output + + `␊ + 1 | -123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e-1;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #24 + 1 | +123_000.e0; + +> Output + + `␊ + 1 | +123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e0;␊ + | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #25 + 1 | -123_000.e0; + +> Output + + `␊ + 1 | -123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e0;␊ + | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #26 + 1 | +123_000.e+0; + +> Output + + `␊ + 1 | +123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e+0;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #27 + 1 | -123_000.e+0; + +> Output + + `␊ + 1 | -123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e+0;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #28 + 1 | +123_000.e-0; + +> Output + + `␊ + 1 | +123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e-0;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #29 + 1 | -123_000.e-0; + +> Output + + `␊ + 1 | -123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e-0;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #30 + 1 | +123_000.e10; + +> Output + + `␊ + 1 | +123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e10;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #31 + 1 | -123_000.e10; + +> Output + + `␊ + 1 | -123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e10;␊ + | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #32 + 1 | +123_000.e+10; + +> Output + + `␊ + 1 | +123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e+10;␊ + | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #33 + 1 | -123_000.e+10; + +> Output + + `␊ + 1 | -123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e+10;␊ + | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #34 + 1 | +123_000.e-10; + +> Output + + `␊ + 1 | +123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.e-10;␊ + | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #35 + 1 | -123_000.e-10; + +> Output + + `␊ + 1 | -123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.e-10;␊ + | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #36 + 1 | +123_000.E-10; + +> Output + + `␊ + 1 | +123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.E-10;␊ + | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #37 + 1 | -123_000.E-10; + +> Output + + `␊ + 1 | -123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.E-10;␊ + | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #38 + 1 | +123_000.E-10_10; + +> Output + + `␊ + 1 | +123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.E-10_10;␊ + | ^^^^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #39 + 1 | -123_000.E-10_10; + +> Output + + `␊ + 1 | -123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.E-10_10;␊ + | ^^^^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #40 + 1 | +123_000.0; + +> Output + + `␊ + 1 | +123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0;␊ + | ^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #41 + 1 | -123_000.0; + +> Output + + `␊ + 1 | -123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0;␊ + | ^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #42 + 1 | +123_000.0e1; + +> Output + + `␊ + 1 | +123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e1;␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #43 + 1 | -123_000.0e1; + +> Output + + `␊ + 1 | -123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e1;␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #44 + 1 | +123_000.0e+1; + +> Output + + `␊ + 1 | +123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e+1;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #45 + 1 | -123_000.0e+1; + +> Output + + `␊ + 1 | -123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e+1;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #46 + 1 | +123_000.0e-1; + +> Output + + `␊ + 1 | +123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e-1;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #47 + 1 | -123_000.0e-1; + +> Output + + `␊ + 1 | -123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e-1;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #48 + 1 | +123_000.0e0; + +> Output + + `␊ + 1 | +123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e0;␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #49 + 1 | -123_000.0e0; + +> Output + + `␊ + 1 | -123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e0;␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #50 + 1 | +123_000.0e+0; + +> Output + + `␊ + 1 | +123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e+0;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #51 + 1 | -123_000.0e+0; + +> Output + + `␊ + 1 | -123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e+0;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #52 + 1 | +123_000.0e-0; + +> Output + + `␊ + 1 | +123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e-0;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #53 + 1 | -123_000.0e-0; + +> Output + + `␊ + 1 | -123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e-0;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #54 + 1 | +123_000.0e10; + +> Output + + `␊ + 1 | +123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e10;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #55 + 1 | -123_000.0e10; + +> Output + + `␊ + 1 | -123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e10;␊ + | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #56 + 1 | +123_000.0e+10; + +> Output + + `␊ + 1 | +123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e+10;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #57 + 1 | -123_000.0e+10; + +> Output + + `␊ + 1 | -123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e+10;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #58 + 1 | +123_000.0e-10; + +> Output + + `␊ + 1 | +123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0e-10;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #59 + 1 | -123_000.0e-10; + +> Output + + `␊ + 1 | -123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0e-10;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #60 + 1 | +123_000.0E-10; + +> Output + + `␊ + 1 | +123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0E-10;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #61 + 1 | -123_000.0E-10; + +> Output + + `␊ + 1 | -123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0E-10;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #62 + 1 | +123_000.0E-10_10; + +> Output + + `␊ + 1 | +123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.0E-10_10;␊ + | ^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #63 + 1 | -123_000.0E-10_10; + +> Output + + `␊ + 1 | -123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.0E-10_10;␊ + | ^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #64 + 1 | +123_000.000; + +> Output + + `␊ + 1 | +123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000;␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #65 + 1 | -123_000.000; + +> Output + + `␊ + 1 | -123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000;␊ + | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #66 + 1 | +123_000.000e1; + +> Output + + `␊ + 1 | +123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e1;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #67 + 1 | -123_000.000e1; + +> Output + + `␊ + 1 | -123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e1;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #68 + 1 | +123_000.000e+1; + +> Output + + `␊ + 1 | +123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e+1;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #69 + 1 | -123_000.000e+1; + +> Output + + `␊ + 1 | -123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e+1;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #70 + 1 | +123_000.000e-1; + +> Output + + `␊ + 1 | +123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e-1;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #71 + 1 | -123_000.000e-1; + +> Output + + `␊ + 1 | -123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e-1;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #72 + 1 | +123_000.000e0; + +> Output + + `␊ + 1 | +123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e0;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #73 + 1 | -123_000.000e0; + +> Output + + `␊ + 1 | -123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e0;␊ + | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #74 + 1 | +123_000.000e+0; + +> Output + + `␊ + 1 | +123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e+0;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #75 + 1 | -123_000.000e+0; + +> Output + + `␊ + 1 | -123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e+0;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #76 + 1 | +123_000.000e-0; + +> Output + + `␊ + 1 | +123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e-0;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #77 + 1 | -123_000.000e-0; + +> Output + + `␊ + 1 | -123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e-0;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #78 + 1 | +123_000.000e10; + +> Output + + `␊ + 1 | +123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e10;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #79 + 1 | -123_000.000e10; + +> Output + + `␊ + 1 | -123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e10;␊ + | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #80 + 1 | +123_000.000e+10; + +> Output + + `␊ + 1 | +123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e+10;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #81 + 1 | -123_000.000e+10; + +> Output + + `␊ + 1 | -123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e+10;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #82 + 1 | +123_000.000e-10; + +> Output + + `␊ + 1 | +123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000e-10;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #83 + 1 | -123_000.000e-10; + +> Output + + `␊ + 1 | -123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000e-10;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #84 + 1 | +123_000.000E-10; + +> Output + + `␊ + 1 | +123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000E-10;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #85 + 1 | -123_000.000E-10; + +> Output + + `␊ + 1 | -123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000E-10;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #86 + 1 | +123_000.000E-10_10; + +> Output + + `␊ + 1 | +123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #87 + 1 | -123_000.000E-10_10; + +> Output + + `␊ + 1 | -123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #88 + 1 | +123_000.000_000; + +> Output + + `␊ + 1 | +123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #89 + 1 | -123_000.000_000; + +> Output + + `␊ + 1 | -123_000;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #90 + 1 | +123_000.000_000e1; + +> Output + + `␊ + 1 | +123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e1;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #91 + 1 | -123_000.000_000e1; + +> Output + + `␊ + 1 | -123_000e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e1;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #92 + 1 | +123_000.000_000e+1; + +> Output + + `␊ + 1 | +123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e+1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #93 + 1 | -123_000.000_000e+1; + +> Output + + `␊ + 1 | -123_000e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e+1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #94 + 1 | +123_000.000_000e-1; + +> Output + + `␊ + 1 | +123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e-1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #95 + 1 | -123_000.000_000e-1; + +> Output + + `␊ + 1 | -123_000e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e-1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #96 + 1 | +123_000.000_000e0; + +> Output + + `␊ + 1 | +123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e0;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #97 + 1 | -123_000.000_000e0; + +> Output + + `␊ + 1 | -123_000e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e0;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #98 + 1 | +123_000.000_000e+0; + +> Output + + `␊ + 1 | +123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e+0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #99 + 1 | -123_000.000_000e+0; + +> Output + + `␊ + 1 | -123_000e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e+0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #100 + 1 | +123_000.000_000e-0; + +> Output + + `␊ + 1 | +123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e-0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #101 + 1 | -123_000.000_000e-0; + +> Output + + `␊ + 1 | -123_000e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e-0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #102 + 1 | +123_000.000_000e10; + +> Output + + `␊ + 1 | +123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #103 + 1 | -123_000.000_000e10; + +> Output + + `␊ + 1 | -123_000e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #104 + 1 | +123_000.000_000e+10; + +> Output + + `␊ + 1 | +123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e+10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #105 + 1 | -123_000.000_000e+10; + +> Output + + `␊ + 1 | -123_000e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e+10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #106 + 1 | +123_000.000_000e-10; + +> Output + + `␊ + 1 | +123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000e-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #107 + 1 | -123_000.000_000e-10; + +> Output + + `␊ + 1 | -123_000e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000e-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #108 + 1 | +123_000.000_000E-10; + +> Output + + `␊ + 1 | +123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000E-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #109 + 1 | -123_000.000_000E-10; + +> Output + + `␊ + 1 | -123_000E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000E-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #110 + 1 | +123_000.000_000E-10_10; + +> Output + + `␊ + 1 | +123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_000E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #111 + 1 | -123_000.000_000E-10_10; + +> Output + + `␊ + 1 | -123_000E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_000E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #112 + 1 | +123_000.123_000; + +> Output + + `␊ + 1 | +123_000.123;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #113 + 1 | -123_000.123_000; + +> Output + + `␊ + 1 | -123_000.123;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #114 + 1 | +123_000.123_000e1; + +> Output + + `␊ + 1 | +123_000.123e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e1;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #115 + 1 | -123_000.123_000e1; + +> Output + + `␊ + 1 | -123_000.123e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e1;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #116 + 1 | +123_000.123_000e+1; + +> Output + + `␊ + 1 | +123_000.123e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e+1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #117 + 1 | -123_000.123_000e+1; + +> Output + + `␊ + 1 | -123_000.123e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e+1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #118 + 1 | +123_000.123_000e-1; + +> Output + + `␊ + 1 | +123_000.123e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e-1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #119 + 1 | -123_000.123_000e-1; + +> Output + + `␊ + 1 | -123_000.123e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e-1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #120 + 1 | +123_000.123_000e0; + +> Output + + `␊ + 1 | +123_000.123e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e0;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #121 + 1 | -123_000.123_000e0; + +> Output + + `␊ + 1 | -123_000.123e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e0;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #122 + 1 | +123_000.123_000e+0; + +> Output + + `␊ + 1 | +123_000.123e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e+0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #123 + 1 | -123_000.123_000e+0; + +> Output + + `␊ + 1 | -123_000.123e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e+0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #124 + 1 | +123_000.123_000e-0; + +> Output + + `␊ + 1 | +123_000.123e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e-0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #125 + 1 | -123_000.123_000e-0; + +> Output + + `␊ + 1 | -123_000.123e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e-0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #126 + 1 | +123_000.123_000e10; + +> Output + + `␊ + 1 | +123_000.123e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #127 + 1 | -123_000.123_000e10; + +> Output + + `␊ + 1 | -123_000.123e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #128 + 1 | +123_000.123_000e+10; + +> Output + + `␊ + 1 | +123_000.123e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e+10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #129 + 1 | -123_000.123_000e+10; + +> Output + + `␊ + 1 | -123_000.123e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e+10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #130 + 1 | +123_000.123_000e-10; + +> Output + + `␊ + 1 | +123_000.123e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000e-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #131 + 1 | -123_000.123_000e-10; + +> Output + + `␊ + 1 | -123_000.123e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000e-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #132 + 1 | +123_000.123_000E-10; + +> Output + + `␊ + 1 | +123_000.123E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000E-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #133 + 1 | -123_000.123_000E-10; + +> Output + + `␊ + 1 | -123_000.123E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000E-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #134 + 1 | +123_000.123_000E-10_10; + +> Output + + `␊ + 1 | +123_000.123E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.123_000E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #135 + 1 | -123_000.123_000E-10_10; + +> Output + + `␊ + 1 | -123_000.123E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.123_000E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #136 + 1 | +123_000.000_400; + +> Output + + `␊ + 1 | +123_000.000_4;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #137 + 1 | -123_000.000_400; + +> Output + + `␊ + 1 | -123_000.000_4;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400;␊ + | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #138 + 1 | +123_000.000_400e1; + +> Output + + `␊ + 1 | +123_000.000_4e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e1;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #139 + 1 | -123_000.000_400e1; + +> Output + + `␊ + 1 | -123_000.000_4e1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e1;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #140 + 1 | +123_000.000_400e+1; + +> Output + + `␊ + 1 | +123_000.000_4e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e+1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #141 + 1 | -123_000.000_400e+1; + +> Output + + `␊ + 1 | -123_000.000_4e+1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e+1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #142 + 1 | +123_000.000_400e-1; + +> Output + + `␊ + 1 | +123_000.000_4e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e-1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #143 + 1 | -123_000.000_400e-1; + +> Output + + `␊ + 1 | -123_000.000_4e-1;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e-1;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #144 + 1 | +123_000.000_400e0; + +> Output + + `␊ + 1 | +123_000.000_4e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e0;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #145 + 1 | -123_000.000_400e0; + +> Output + + `␊ + 1 | -123_000.000_4e0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e0;␊ + | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #146 + 1 | +123_000.000_400e+0; + +> Output + + `␊ + 1 | +123_000.000_4e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e+0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #147 + 1 | -123_000.000_400e+0; + +> Output + + `␊ + 1 | -123_000.000_4e+0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e+0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #148 + 1 | +123_000.000_400e-0; + +> Output + + `␊ + 1 | +123_000.000_4e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e-0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #149 + 1 | -123_000.000_400e-0; + +> Output + + `␊ + 1 | -123_000.000_4e-0;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e-0;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #150 + 1 | +123_000.000_400e10; + +> Output + + `␊ + 1 | +123_000.000_4e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #151 + 1 | -123_000.000_400e10; + +> Output + + `␊ + 1 | -123_000.000_4e10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e10;␊ + | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #152 + 1 | +123_000.000_400e+10; + +> Output + + `␊ + 1 | +123_000.000_4e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e+10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #153 + 1 | -123_000.000_400e+10; + +> Output + + `␊ + 1 | -123_000.000_4e+10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e+10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #154 + 1 | +123_000.000_400e-10; + +> Output + + `␊ + 1 | +123_000.000_4e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400e-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #155 + 1 | -123_000.000_400e-10; + +> Output + + `␊ + 1 | -123_000.000_4e-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400e-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #156 + 1 | +123_000.000_400E-10; + +> Output + + `␊ + 1 | +123_000.000_4E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400E-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #157 + 1 | -123_000.000_400E-10; + +> Output + + `␊ + 1 | -123_000.000_4E-10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400E-10;␊ + | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #158 + 1 | +123_000.000_400E-10_10; + +> Output + + `␊ + 1 | +123_000.000_4E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | +123_000.000_400E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #159 + 1 | -123_000.000_400E-10_10; + +> Output + + `␊ + 1 | -123_000.000_4E-10_10;␊ + ` + +> Error 1/1 + + `␊ + > 1 | -123_000.000_400E-10_10;␊ + | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + ` diff --git a/test/snapshots/no-zero-fractions.mjs.snap b/test/snapshots/no-zero-fractions.mjs.snap index 0433b4a1c6fd50c9d529ef5faa1376f72ec33408..ecfc176c13d9435ab69add961fcca6a16995ac0d 100644 GIT binary patch literal 5805 zcmV;e7E+xy42l@uZkhDvp$QBF>yi0B$hb23GPG-#ldbj>Psn_M!>5Fru2%A6r(EOX{$ z47nj8Bvb#j*IDkZv-j?tM|=10@p*clufu*CrYzU$-;6bo@}ejZXamQWs&~k}XEh za2*7CEV9UA~rJGB)O1(BWlboqpSeFiBz^Ob z)Y|s-0I9roLe@a!-Ii?lT2jSNS399PcV?#n0IA0@`Z5I3Wtnu*kTLbrWwu8j4DL0> z4ItGXlMPYmJzL9M=hXXqS*4jrkN9^2NWFm>EDKvKe==)sNai5>+T1ef3-$y+>SW9{ zvPG50Z1rtzH7nws?&YuD?F*3l2{WZVK`5FIEYp+?n`RYW6{rz&9gZof#$&3;7KM42 zU55}WjO>?H$3^Wu0+8CVgOFf|Qe~1)R85X{vF+le*^fLN08*1M)ez;7g{cosqTXgb z3EDXFjsaY!q}rvUkQtEfvJ*`I>@zp@y@|HlN8M>%08&?C-a&d8d<1z!Ly%{7{Npfw zd@?|)iky%H@_Ub1`MS-$3tukya>XaPk1RlHHb$`%L8!Lz)J=Yvk{{Z2))1L?U*7+yVzGm~x1A!c9l5 z?0|T~vZ#{7Qxfa}Qb89X5fHtXiww_fH*o8GSbCGKV6Fl{>R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MRFMSB8RHQ4H3?W!%;Kft+0r94gl-hw;o*z003xsb8r9v From 5be500f222ae4d593f0ff2b2cf03a76f86b68952 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 15:21:57 +0800 Subject: [PATCH 04/11] Simplify rule & improve report location --- rules/no-zero-fractions.js | 34 ++- test/snapshots/no-zero-fractions.mjs.md | 318 +++++++++++----------- test/snapshots/no-zero-fractions.mjs.snap | Bin 5805 -> 5790 bytes 3 files changed, 179 insertions(+), 173 deletions(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index a687608cd6..4e7ebec6ed 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -1,6 +1,6 @@ 'use strict'; const getDocumentationUrl = require('./utils/get-documentation-url'); -const {isNumber, parseNumber, parseFloat} = require('./utils/numeric'); +const {isNumber} = require('./utils/numeric'); const MESSAGE_ZERO_FRACTION = 'zero-fraction'; const MESSAGE_DANGLING_DOT = 'dangling-dot'; @@ -9,31 +9,37 @@ const messages = { [MESSAGE_DANGLING_DOT]: 'Don\'t use a dangling dot in the number.' }; -const format = text => { - // Legacy octal number `0777` and prefixed number `0o1234` can't has dot. - const {number, mark, sign, power} = parseNumber(text); - const {integer, dot, fractional} = parseFloat(number); - return { - hasDanglingDot: !fractional, - formatted: integer + (dot + fractional).replace(/[0_.]+$/g, '') + mark + sign + power - }; -} - const create = context => { return { Literal: node => { + if (!isNumber(node)) { + return; + } + + // Legacy octal number `0777` and prefixed number `0o1234` can't has dot. const {raw} = node; - if (!isNumber(node) || !raw.includes('.')) { + const match = raw.match(/^(?[\d_]*)(?\.[\d_]*)(?.*)$/); + if (!match) { return; } - const {hasDanglingDot, formatted} = format(raw); + const {before, dotAndFraction, after} = match.groups; + const formatted = before + dotAndFraction.replace(/[0_.]+$/g, '') + after; + if (formatted === raw) { return; } + const hasDanglingDot = dotAndFraction.length === 1; + // End of fractional + const end = node.range[0] + before.length + dotAndFraction.length; + const start = end - (raw.length - formatted.length); + const sourceCode = context.getSourceCode(); context.report({ - node, + loc: { + start: sourceCode.getLocFromIndex(start), + end: sourceCode.getLocFromIndex(end) + }, messageId: hasDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, fix: fixer => fixer.replaceText(node, formatted) }); diff --git a/test/snapshots/no-zero-fractions.mjs.md b/test/snapshots/no-zero-fractions.mjs.md index 1bf8b98107..485182efd2 100644 --- a/test/snapshots/no-zero-fractions.mjs.md +++ b/test/snapshots/no-zero-fractions.mjs.md @@ -17,7 +17,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 1.0␊ - | ^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #2 @@ -33,7 +33,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 1.0 + 1␊ - | ^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #3 @@ -49,7 +49,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo(1.0 + 1)␊ - | ^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #4 @@ -65,7 +65,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 1.00␊ - | ^^^^ Don't use a zero fraction in the number.␊ + | ^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #5 @@ -81,7 +81,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 1.00000␊ - | ^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #6 @@ -97,7 +97,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = -1.0␊ - | ^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #7 @@ -113,7 +113,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 123123123.0␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #8 @@ -129,7 +129,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 123.11100000000␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #9 @@ -145,7 +145,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 1.␊ - | ^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #10 @@ -161,7 +161,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = +1.␊ - | ^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #11 @@ -177,7 +177,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = -1.␊ - | ^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #12 @@ -193,7 +193,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = 1.e10␊ - | ^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #13 @@ -209,7 +209,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = +1.e-10␊ - | ^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #14 @@ -225,7 +225,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = -1.e+10␊ - | ^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #15 @@ -241,7 +241,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const foo = (1.).toString()␊ - | ^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #16 @@ -257,7 +257,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.;␊ - | ^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #17 @@ -273,7 +273,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.;␊ - | ^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #18 @@ -289,7 +289,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e1;␊ - | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #19 @@ -305,7 +305,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e1;␊ - | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #20 @@ -321,7 +321,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e+1;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #21 @@ -337,7 +337,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e+1;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #22 @@ -353,7 +353,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e-1;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #23 @@ -369,7 +369,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e-1;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #24 @@ -385,7 +385,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e0;␊ - | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #25 @@ -401,7 +401,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e0;␊ - | ^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #26 @@ -417,7 +417,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e+0;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #27 @@ -433,7 +433,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e+0;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #28 @@ -449,7 +449,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e-0;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #29 @@ -465,7 +465,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e-0;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #30 @@ -481,7 +481,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e10;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #31 @@ -497,7 +497,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e10;␊ - | ^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #32 @@ -513,7 +513,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e+10;␊ - | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #33 @@ -529,7 +529,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e+10;␊ - | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #34 @@ -545,7 +545,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.e-10;␊ - | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #35 @@ -561,7 +561,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.e-10;␊ - | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #36 @@ -577,7 +577,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.E-10;␊ - | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #37 @@ -593,7 +593,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.E-10;␊ - | ^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #38 @@ -609,7 +609,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.E-10_10;␊ - | ^^^^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #39 @@ -625,7 +625,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.E-10_10;␊ - | ^^^^^^^^^^^^^^^ Don't use a dangling dot in the number.␊ + | ^ Don't use a dangling dot in the number.␊ ` ## Invalid #40 @@ -641,7 +641,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0;␊ - | ^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #41 @@ -657,7 +657,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0;␊ - | ^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #42 @@ -673,7 +673,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e1;␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #43 @@ -689,7 +689,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e1;␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #44 @@ -705,7 +705,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e+1;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #45 @@ -721,7 +721,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e+1;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #46 @@ -737,7 +737,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e-1;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #47 @@ -753,7 +753,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e-1;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #48 @@ -769,7 +769,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e0;␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #49 @@ -785,7 +785,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e0;␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #50 @@ -801,7 +801,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e+0;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #51 @@ -817,7 +817,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e+0;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #52 @@ -833,7 +833,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e-0;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #53 @@ -849,7 +849,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e-0;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #54 @@ -865,7 +865,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e10;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #55 @@ -881,7 +881,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e10;␊ - | ^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #56 @@ -897,7 +897,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e+10;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #57 @@ -913,7 +913,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e+10;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #58 @@ -929,7 +929,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0e-10;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #59 @@ -945,7 +945,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0e-10;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #60 @@ -961,7 +961,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0E-10;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #61 @@ -977,7 +977,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0E-10;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #62 @@ -993,7 +993,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.0E-10_10;␊ - | ^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #63 @@ -1009,7 +1009,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.0E-10_10;␊ - | ^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #64 @@ -1025,7 +1025,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000;␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #65 @@ -1041,7 +1041,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000;␊ - | ^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #66 @@ -1057,7 +1057,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e1;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #67 @@ -1073,7 +1073,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e1;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #68 @@ -1089,7 +1089,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e+1;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #69 @@ -1105,7 +1105,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e+1;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #70 @@ -1121,7 +1121,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e-1;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #71 @@ -1137,7 +1137,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e-1;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #72 @@ -1153,7 +1153,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e0;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #73 @@ -1169,7 +1169,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e0;␊ - | ^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #74 @@ -1185,7 +1185,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e+0;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #75 @@ -1201,7 +1201,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e+0;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #76 @@ -1217,7 +1217,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e-0;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #77 @@ -1233,7 +1233,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e-0;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #78 @@ -1249,7 +1249,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e10;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #79 @@ -1265,7 +1265,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e10;␊ - | ^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #80 @@ -1281,7 +1281,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e+10;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #81 @@ -1297,7 +1297,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e+10;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #82 @@ -1313,7 +1313,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000e-10;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #83 @@ -1329,7 +1329,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000e-10;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #84 @@ -1345,7 +1345,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000E-10;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #85 @@ -1361,7 +1361,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000E-10;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #86 @@ -1377,7 +1377,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #87 @@ -1393,7 +1393,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #88 @@ -1409,7 +1409,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #89 @@ -1425,7 +1425,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #90 @@ -1441,7 +1441,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e1;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #91 @@ -1457,7 +1457,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e1;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #92 @@ -1473,7 +1473,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e+1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #93 @@ -1489,7 +1489,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e+1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #94 @@ -1505,7 +1505,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e-1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #95 @@ -1521,7 +1521,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e-1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #96 @@ -1537,7 +1537,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e0;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #97 @@ -1553,7 +1553,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e0;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #98 @@ -1569,7 +1569,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e+0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #99 @@ -1585,7 +1585,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e+0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #100 @@ -1601,7 +1601,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e-0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #101 @@ -1617,7 +1617,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e-0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #102 @@ -1633,7 +1633,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #103 @@ -1649,7 +1649,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #104 @@ -1665,7 +1665,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e+10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #105 @@ -1681,7 +1681,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e+10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #106 @@ -1697,7 +1697,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000e-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #107 @@ -1713,7 +1713,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000e-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #108 @@ -1729,7 +1729,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000E-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #109 @@ -1745,7 +1745,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000E-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #110 @@ -1761,7 +1761,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_000E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #111 @@ -1777,7 +1777,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_000E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #112 @@ -1793,7 +1793,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #113 @@ -1809,7 +1809,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #114 @@ -1825,7 +1825,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e1;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #115 @@ -1841,7 +1841,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e1;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #116 @@ -1857,7 +1857,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e+1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #117 @@ -1873,7 +1873,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e+1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #118 @@ -1889,7 +1889,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e-1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #119 @@ -1905,7 +1905,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e-1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #120 @@ -1921,7 +1921,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e0;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #121 @@ -1937,7 +1937,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e0;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #122 @@ -1953,7 +1953,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e+0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #123 @@ -1969,7 +1969,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e+0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #124 @@ -1985,7 +1985,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e-0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #125 @@ -2001,7 +2001,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e-0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #126 @@ -2017,7 +2017,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #127 @@ -2033,7 +2033,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #128 @@ -2049,7 +2049,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e+10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #129 @@ -2065,7 +2065,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e+10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #130 @@ -2081,7 +2081,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000e-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #131 @@ -2097,7 +2097,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000e-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #132 @@ -2113,7 +2113,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000E-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #133 @@ -2129,7 +2129,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000E-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #134 @@ -2145,7 +2145,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.123_000E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #135 @@ -2161,7 +2161,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.123_000E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^^^ Don't use a zero fraction in the number.␊ ` ## Invalid #136 @@ -2177,7 +2177,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #137 @@ -2193,7 +2193,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400;␊ - | ^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #138 @@ -2209,7 +2209,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e1;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #139 @@ -2225,7 +2225,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e1;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #140 @@ -2241,7 +2241,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e+1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #141 @@ -2257,7 +2257,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e+1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #142 @@ -2273,7 +2273,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e-1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #143 @@ -2289,7 +2289,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e-1;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #144 @@ -2305,7 +2305,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e0;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #145 @@ -2321,7 +2321,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e0;␊ - | ^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #146 @@ -2337,7 +2337,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e+0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #147 @@ -2353,7 +2353,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e+0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #148 @@ -2369,7 +2369,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e-0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #149 @@ -2385,7 +2385,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e-0;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #150 @@ -2401,7 +2401,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #151 @@ -2417,7 +2417,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e10;␊ - | ^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #152 @@ -2433,7 +2433,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e+10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #153 @@ -2449,7 +2449,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e+10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #154 @@ -2465,7 +2465,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400e-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #155 @@ -2481,7 +2481,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400e-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #156 @@ -2497,7 +2497,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400E-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #157 @@ -2513,7 +2513,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400E-10;␊ - | ^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #158 @@ -2529,7 +2529,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | +123_000.000_400E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` ## Invalid #159 @@ -2545,5 +2545,5 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | -123_000.000_400E-10_10;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Don't use a zero fraction in the number.␊ + | ^^ Don't use a zero fraction in the number.␊ ` diff --git a/test/snapshots/no-zero-fractions.mjs.snap b/test/snapshots/no-zero-fractions.mjs.snap index ecfc176c13d9435ab69add961fcca6a16995ac0d..ca8c103ba399d4ca9ff360fb78bae7bea18cb465 100644 GIT binary patch literal 5790 zcmV;P7Gdc@RzVBOKKD82)%uR2(kbf6IiqJc zev)`+E4j75RD2Ym=pP--dPui18%yU72)dwtIr8kBO`jhEq!waSyFrWTVHbx7yXHM# zlL;!mH}?TZ9f$cZMB>%mmK&{?OFoyCe;OUWb^}0aImQ%zsMMt0+1FJxGT+(kElAXs z^9M+sf+>JVJFPa&Ts%~5i?oNga*M?}fYf`K@e&jzGvwL~qm=9R=9iBh?!Mi51VCyi zrh>MZw8(Av!{4GkO$M(!8`7%{AoT;rM-p1hd%U-G>yl%m=O5HF*`#L;kh%hM8`ATI ztnAUT>JGb}6fGY(vcLu)wHY&AilTZojs#Ylbv%H!h2N{>{D}am(U`lC-sb}xQqJ6) z7M#AbCAFbPGeD|j_jV#6vhJ(4eY{vFNFR7yC3<0>?*US`Vt_P7^;;`dW;?lAs$#;? z`__ZzxC5kWVd5cjLzWD-&_4C%Zg%;;qetfU0Z7fk$jd;Bb&nQB2k#r@(2!ptb>4vj zNVUN1rY-6`m#FQL)TmByzFYiDjxRv!IgD`+`0tpFtk94Noo^LZ7oZ+{9rh`$PR1Oe zElLZnxY<(cjU3j#jE_8U1R%8nW8RaZ6l#-wBJ1TyM}gaaxUCQ8DXmsuEP7GY0Ga7#iw&Yv-XS?zowbP#b*!Z(TBAkV^x)gICqCPz4Bex$km=BQJ ziV5sXQG<^pq`V!a7XBz=24yqV*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X$z;HbwnS*Y| z(F}>EVVXaU_^ojosfwCkG2=u@pK&ox5+o!j?)iT^iwlD*K6YV_^f;I`v7WIr#f6}o zrr&cQXagwb6elHE;U>i?-uf}lP^)-(lpQsmW(70vCf2$kL4KZL#d070FZzjYq5JnHXbwYQEj5yv1nBouk;!jQx+2}OreLwl~G)HjN;uRnsAxj`UVrkiPrYU>5xx7E+=wUzaFW$t_WG7klM8t1i=9~%#+lGG4N)qh| zIIUQtuTPcOW#M9|m@)|x%^z20Ple`qGUgeICQB#MCreR7+I%TjrpArN2#eiZEZ*u- zO&uvFv0Xj%+8F)b1lI?`2oa!|n_CfstP=>?06K!OA&W5m-kmS5FO=i&|Dgte##*ttP-$x-#MS^bGOa9+hXiS9Is?MN#*ttPQ_}oMzSvwX&1-TQJEkoF<5NL`<&p_ZCbKngwGV zAetxep!LK8XtM+?bf)=%p{?>4aGVR4pwN=3dYq#GnYMad{0(8_TsG(F48|gwM!qBm zIUW(4BUyTqtJiOI7ju%NSDGv|)>n`Ct5do{4OTNxint5Voam$I&!FkwJKzqWzZZsm z294|un?E~K!dS%9X4kob{-gqnUas#`;r9N=c%i*#~cw>jmzT#>}TNt(jx= zyE!fPogms3PP|?5HiqtDB)8>>l%b%e^67`6Wkm%Hc8!`mU^UC7P8V*NmaDFK{XO@4jjRYo``cR$SsyHp0 z$xj)HHjcHp%8)R7gY*F%N7d`haV6aYQdU!k5||v?J3sb+*#LbOUgBlK zWpz!{DkRBWu-3^NNm^mZT?$<6a~&F|oz1cz$!@zQQ98lV<8{itzMz@-D>~<`NTh^ From f16ccfb135c6d0a69f60f129302475c0a1473774 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 15:36:26 +0800 Subject: [PATCH 05/11] Handle parentheses, semi --- rules/no-zero-fractions.js | 22 ++- rules/numeric-separators-style.js | 2 +- rules/utils/numeric.js | 17 ++- ...parentheses-to-member-expression-object.js | 4 +- test/no-zero-fractions.mjs | 29 +++- test/snapshots/no-zero-fractions.mjs.md | 140 ++++++++++++++++++ test/snapshots/no-zero-fractions.mjs.snap | Bin 5790 -> 6167 bytes 7 files changed, 201 insertions(+), 13 deletions(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index 4e7ebec6ed..b3cef44436 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -1,6 +1,8 @@ 'use strict'; +const {isParenthesized} = require('eslint-utils'); const getDocumentationUrl = require('./utils/get-documentation-url'); -const {isNumber} = require('./utils/numeric'); +const needsSemicolon = require('./utils/needs-semicolon'); +const {isNumber, isDecimalInteger} = require('./utils/numeric'); const MESSAGE_ZERO_FRACTION = 'zero-fraction'; const MESSAGE_DANGLING_DOT = 'dangling-dot'; @@ -41,7 +43,23 @@ const create = context => { end: sourceCode.getLocFromIndex(end) }, messageId: hasDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, - fix: fixer => fixer.replaceText(node, formatted) + fix: fixer => { + let fixed = formatted; + if ( + node.parent.type === 'MemberExpression' && + node.parent.object === node && + isDecimalInteger(formatted) && + !isParenthesized(node, sourceCode) + ) { + fixed = `(${fixed})`; + + if (needsSemicolon(sourceCode.getTokenBefore(node), sourceCode, fixed)) { + fixed = `;${fixed}`; + } + } + + return fixer.replaceText(node, fixed); + } }); } }; diff --git a/rules/numeric-separators-style.js b/rules/numeric-separators-style.js index 9b1f20b6d4..bd47fd7009 100644 --- a/rules/numeric-separators-style.js +++ b/rules/numeric-separators-style.js @@ -99,7 +99,7 @@ const create = context => { return { Literal: node => { - if (!numeric.isNumberic(node) || numeric.isLegacyOctal(node)) { + if (!numeric.isNumeric(node) || numeric.isLegacyOctal(node)) { return; } diff --git a/rules/utils/numeric.js b/rules/utils/numeric.js index 3c48f6750d..16cc350233 100644 --- a/rules/utils/numeric.js +++ b/rules/utils/numeric.js @@ -3,11 +3,12 @@ // Determine whether this node is a decimal integer literal. // Copied from https://github.com/eslint/eslint/blob/cc4871369645c3409dc56ded7a555af8a9f63d51/lib/rules/utils/ast-utils.js#L1237 const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; -const isDecimalInteger = node => isNumber(node) && DECIMAL_INTEGER_PATTERN.test(node.raw); +const isDecimalInteger = text => DECIMAL_INTEGER_PATTERN.test(text); +const isDecimalIntegerNode = node => isNumber(node) && isDecimalInteger(node.raw); const isNumber = node => typeof node.value === 'number'; const isBigInt = node => Boolean(node.bigint); -const isNumberic = node => isNumber(node) || isBigInt(node); +const isNumeric = node => isNumber(node) || isBigInt(node); const isLegacyOctal = node => isNumber(node) && /^0\d+$/.test(node.raw); function getPrefix(text) { @@ -41,4 +42,14 @@ function parseFloat(text) { return {integer, dot, fractional}; } -module.exports = {isNumber, isBigInt, isNumberic, isLegacyOctal, getPrefix, parseNumber, parseFloat, isDecimalInteger}; +module.exports = { + isDecimalIntegerNode, + isDecimalInteger, + isNumber, + isBigInt, + isNumeric, + isLegacyOctal, + getPrefix, + parseNumber, + parseFloat +}; diff --git a/rules/utils/should-add-parentheses-to-member-expression-object.js b/rules/utils/should-add-parentheses-to-member-expression-object.js index fbad4f099f..d945204599 100644 --- a/rules/utils/should-add-parentheses-to-member-expression-object.js +++ b/rules/utils/should-add-parentheses-to-member-expression-object.js @@ -1,7 +1,7 @@ 'use strict'; const isNewExpressionWithParentheses = require('./is-new-expression-with-parentheses'); -const {isDecimalInteger} = require('./numeric'); +const {isDecimalIntegerNode} = require('./numeric'); /** Check if parentheses should to be added to a `node` when it's used as an `object` of `MemberExpression`. @@ -24,7 +24,7 @@ function shouldAddParenthesesToMemberExpressionObject(node, sourceCode) { return !isNewExpressionWithParentheses(node, sourceCode); case 'Literal': { /* istanbul ignore next */ - if (isDecimalInteger(node)) { + if (isDecimalIntegerNode(node)) { return true; } diff --git a/test/no-zero-fractions.mjs b/test/no-zero-fractions.mjs index 6e67068501..c243bebcc6 100644 --- a/test/no-zero-fractions.mjs +++ b/test/no-zero-fractions.mjs @@ -1,3 +1,4 @@ +import outdent from 'outdent'; import {getTester} from './utils/test.mjs'; const {test} = getTester(import.meta); @@ -13,7 +14,8 @@ test.snapshot({ 'const foo = 1.1', 'const foo = -1.1', 'const foo = 123123123.4', - 'const foo = 1e3' + 'const foo = 1e3', + '1 .toString()' ], invalid: [ 'const foo = 1.0', @@ -57,9 +59,26 @@ test.snapshot({ `+${number}`, `-${number}` ]) - .flatMap(number => [ - `${number};` - ]) - + .map(number => `${number};`), + '1.00.toFixed(2)', + '1.00 .toFixed(2)', + '(1.00).toFixed(2)', + '1.00?.toFixed(2)', + outdent` + console.log() + 1..toString() + `, + outdent` + console.log() + a[1.].toString() + `, + outdent` + console.log() + 1.00e10.toString() + `, + outdent` + console.log() + a[1.00e10].toString() + ` ] }); diff --git a/test/snapshots/no-zero-fractions.mjs.md b/test/snapshots/no-zero-fractions.mjs.md index 485182efd2..79583f4d6a 100644 --- a/test/snapshots/no-zero-fractions.mjs.md +++ b/test/snapshots/no-zero-fractions.mjs.md @@ -2547,3 +2547,143 @@ Generated by [AVA](https://avajs.dev). > 1 | -123_000.000_400E-10_10;␊ | ^^ Don't use a zero fraction in the number.␊ ` + +## Invalid #160 + 1 | 1.00.toFixed(2) + +> Output + + `␊ + 1 | (1).toFixed(2)␊ + ` + +> Error 1/1 + + `␊ + > 1 | 1.00.toFixed(2)␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #161 + 1 | 1.00 .toFixed(2) + +> Output + + `␊ + 1 | (1) .toFixed(2)␊ + ` + +> Error 1/1 + + `␊ + > 1 | 1.00 .toFixed(2)␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #162 + 1 | (1.00).toFixed(2) + +> Output + + `␊ + 1 | (1).toFixed(2)␊ + ` + +> Error 1/1 + + `␊ + > 1 | (1.00).toFixed(2)␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #163 + 1 | 1.00?.toFixed(2) + +> Output + + `␊ + 1 | (1)?.toFixed(2)␊ + ` + +> Error 1/1 + + `␊ + > 1 | 1.00?.toFixed(2)␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #164 + 1 | console.log() + 2 | 1..toString() + +> Output + + `␊ + 1 | console.log()␊ + 2 | ;(1).toString()␊ + ` + +> Error 1/1 + + `␊ + 1 | console.log()␊ + > 2 | 1..toString()␊ + | ^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #165 + 1 | console.log() + 2 | a[1.].toString() + +> Output + + `␊ + 1 | console.log()␊ + 2 | a[1].toString()␊ + ` + +> Error 1/1 + + `␊ + 1 | console.log()␊ + > 2 | a[1.].toString()␊ + | ^ Don't use a dangling dot in the number.␊ + ` + +## Invalid #166 + 1 | console.log() + 2 | 1.00e10.toString() + +> Output + + `␊ + 1 | console.log()␊ + 2 | 1e10.toString()␊ + ` + +> Error 1/1 + + `␊ + 1 | console.log()␊ + > 2 | 1.00e10.toString()␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` + +## Invalid #167 + 1 | console.log() + 2 | a[1.00e10].toString() + +> Output + + `␊ + 1 | console.log()␊ + 2 | a[1e10].toString()␊ + ` + +> Error 1/1 + + `␊ + 1 | console.log()␊ + > 2 | a[1.00e10].toString()␊ + | ^^^ Don't use a zero fraction in the number.␊ + ` diff --git a/test/snapshots/no-zero-fractions.mjs.snap b/test/snapshots/no-zero-fractions.mjs.snap index ca8c103ba399d4ca9ff360fb78bae7bea18cb465..a33da6eed813f897526c78bf33d3970f0f49a980 100644 GIT binary patch literal 6167 zcmV+y80hCgRzV>rB=00000000BU zoC#b`+5g9{law_rqNtvVR;3amO4hVWw$dVcT106x6sAI2Y*|J^2+3rovP39_u^Yu$ z5+g+>TL?+g|J?H&GkWg1J|-*fIYSEi@~6!qkS@w1yh zOTD-5n5rxtw+K-5j}B%7q{Em^#lF1*FR5RRI6r6emq!4phcW#+K#Q3nmxs=C&UwCO zA1EJg?hTMS4)Z%i>h-OBf)} z2S}ZU$%Du^tT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p!qru0OHg732EKi-?Oy#9}(jE{@;Kko83l_mPE>42f9~ z`^S{mzUkzpU&qU^oWI`^D({Q6$K>Pvmgq=J^k?LImb_kkWeg0r>8fZ)LVDQ8&)EO!sY`%)ENYH6gKAp#S6dWgOmA}~QWn7F(dLMnS2 zit(P?klXj%Vx+N*;xC6^sv?G)Wxl88?k?G2!XW6G=o>|bc|=CQe?U*D7T`-55Iqy4 z4*vs(gCkxxOS}cjd$qBXw>jiOEX&gzZZ|(7bE$s{YdpV&==_oXURQ0N^v zpU=Qqzu@HSSCHK2Fr7FT;_(`{kKxG$aj|Cx=Qn4F`IPw2{djovEykq@w!#h%2N)t> zrx5aP?qBY9e!#@My1?}_YsNvjaVK|rh4V?CPC+{fIkQ-vgBr8G2<5OU%Dy%1@VcA( zts(2(F4lV`d_B!%e_u_$e$K}&8`h07@mqnoYyrzRX^Hh+4SXacqOVyq&pbKHso8dZ cV!u=6{9s4q1Yy26>_TV!A1FUC@(OAI0B*NbN&o-= From a2bff759f36b6018efb0a8c6e289d30a6b70e647 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 15:39:41 +0800 Subject: [PATCH 06/11] numeric tweak --- rules/numeric-separators-style.js | 2 +- rules/utils/numeric.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rules/numeric-separators-style.js b/rules/numeric-separators-style.js index bd47fd7009..ad1ed55e8a 100644 --- a/rules/numeric-separators-style.js +++ b/rules/numeric-separators-style.js @@ -35,7 +35,7 @@ function addSeparatorFromLeft(value, options) { } function formatNumber(value, options) { - const {integer, dot, fractional} = numeric.parseFloat(value); + const {integer, dot, fractional} = numeric.parseFloatNumber(value); return addSeparator(integer, options) + dot + addSeparatorFromLeft(fractional, options); } diff --git a/rules/utils/numeric.js b/rules/utils/numeric.js index 16cc350233..c661b0184d 100644 --- a/rules/utils/numeric.js +++ b/rules/utils/numeric.js @@ -29,12 +29,12 @@ function parseNumber(text) { mark = '', sign = '', power = '' - } = text.match(/^(?.*?)(?:(?e)(?[+-])?(?.+))?$/i).groups; + } = text.match(/^(?[\d_.]*?)(?:(?e)(?[+-])?(?[\d_]+))?$/i).groups; return {number, mark, sign, power}; } -function parseFloat(text) { +function parseFloatNumber(text) { const parts = text.split('.'); const [integer, fractional = ''] = parts; const dot = parts.length === 2 ? '.' : ''; @@ -51,5 +51,5 @@ module.exports = { isLegacyOctal, getPrefix, parseNumber, - parseFloat + parseFloatNumber }; From 4f31407955aa8f8c1c059fd63734572739b5146f Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 15:40:23 +0800 Subject: [PATCH 07/11] Update regexp --- rules/utils/numeric.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/utils/numeric.js b/rules/utils/numeric.js index c661b0184d..f6eb7f678d 100644 --- a/rules/utils/numeric.js +++ b/rules/utils/numeric.js @@ -29,7 +29,7 @@ function parseNumber(text) { mark = '', sign = '', power = '' - } = text.match(/^(?[\d_.]*?)(?:(?e)(?[+-])?(?[\d_]+))?$/i).groups; + } = text.match(/^(?[\d_.]*?)(?:(?[eE])(?[+-])?(?[\d_]+))?$/).groups; return {number, mark, sign, power}; } From 30502ffbfa99474037ecc81e2a8b4f6e637f40b4 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 15:49:36 +0800 Subject: [PATCH 08/11] Update docs --- docs/rules/no-zero-fractions.md | 41 +++++++++++++++++++++++++++++---- rules/no-zero-fractions.js | 4 ++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/docs/rules/no-zero-fractions.md b/docs/rules/no-zero-fractions.md index 37d52f796f..c0d323e3fa 100644 --- a/docs/rules/no-zero-fractions.md +++ b/docs/rules/no-zero-fractions.md @@ -4,27 +4,58 @@ There is no difference in JavaScript between, for example, `1`, `1.0` and `1.`, This rule is fixable. - ## Fail ```js const foo = 1.0; +``` + +```js const foo = -1.0; -const foo = 123123123.0; +``` + +```js +const foo = 123_456.000_000; +``` + +```js const foo = 1.; +``` + +```js const foo = 123.111000000; -const foo = 123.00e20; ``` +```js +const foo = 123.00e20; +``` ## Pass ```js const foo = 1; +``` + +```js const foo = -1; -const foo = 123123123; +``` + +```js +const foo = 123456; +``` + +```js const foo = 1.1; +``` + +```js const foo = -1.1; -const foo = 123123123.4; +``` + +```js +const foo = 123.456; +``` + +```js const foo = 1e3; ``` diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index b3cef44436..a2aded4520 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -32,7 +32,7 @@ const create = context => { return; } - const hasDanglingDot = dotAndFraction.length === 1; + const isDanglingDot = dotAndFraction === '.'; // End of fractional const end = node.range[0] + before.length + dotAndFraction.length; const start = end - (raw.length - formatted.length); @@ -42,7 +42,7 @@ const create = context => { start: sourceCode.getLocFromIndex(start), end: sourceCode.getLocFromIndex(end) }, - messageId: hasDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, + messageId: isDanglingDot ? MESSAGE_DANGLING_DOT : MESSAGE_ZERO_FRACTION, fix: fixer => { let fixed = formatted; if ( From fc4924a53a0d8553d27559bfe884d77251c5bb3a Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 15:55:33 +0800 Subject: [PATCH 09/11] Make `unicorn/better-regex` happy --- rules/no-zero-fractions.js | 2 +- rules/utils/numeric.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index a2aded4520..eedac1aa39 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -26,7 +26,7 @@ const create = context => { } const {before, dotAndFraction, after} = match.groups; - const formatted = before + dotAndFraction.replace(/[0_.]+$/g, '') + after; + const formatted = before + dotAndFraction.replace(/[.0_]+$/g, '') + after; if (formatted === raw) { return; diff --git a/rules/utils/numeric.js b/rules/utils/numeric.js index f6eb7f678d..6d698755b8 100644 --- a/rules/utils/numeric.js +++ b/rules/utils/numeric.js @@ -29,7 +29,7 @@ function parseNumber(text) { mark = '', sign = '', power = '' - } = text.match(/^(?[\d_.]*?)(?:(?[eE])(?[+-])?(?[\d_]+))?$/).groups; + } = text.match(/^(?[\d._]*?)(?:(?[Ee])(?[+-])?(?[\d_]+))?$/).groups; return {number, mark, sign, power}; } From e33539f0e32e8567878b295c976b2fc48e911ead Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Apr 2021 16:01:23 +0800 Subject: [PATCH 10/11] Variables --- rules/no-zero-fractions.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index eedac1aa39..1a588c28d6 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -20,21 +20,21 @@ const create = context => { // Legacy octal number `0777` and prefixed number `0o1234` can't has dot. const {raw} = node; - const match = raw.match(/^(?[\d_]*)(?\.[\d_]*)(?.*)$/); + const match = raw.match(/^(?[\d_]*)(?\.[\d_]*)(?.*)$/); if (!match) { return; } - const {before, dotAndFraction, after} = match.groups; - const formatted = before + dotAndFraction.replace(/[.0_]+$/g, '') + after; + const {before, dotAndFractions, after} = match.groups; + const formatted = before + dotAndFractions.replace(/[.0_]+$/g, '') + after; if (formatted === raw) { return; } - const isDanglingDot = dotAndFraction === '.'; - // End of fractional - const end = node.range[0] + before.length + dotAndFraction.length; + const isDanglingDot = dotAndFractions === '.'; + // End of fractions + const end = node.range[0] + before.length + dotAndFractions.length; const start = end - (raw.length - formatted.length); const sourceCode = context.getSourceCode(); context.report({ From 5380bbeb612e425e607e0881b12e27b5db54d645 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 30 Apr 2021 20:38:08 +0700 Subject: [PATCH 11/11] Update no-zero-fractions.js --- rules/no-zero-fractions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index 1a588c28d6..8830fd8cd4 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -18,7 +18,7 @@ const create = context => { return; } - // Legacy octal number `0777` and prefixed number `0o1234` can't has dot. + // Legacy octal number `0777` and prefixed number `0o1234` cannot have a dot. const {raw} = node; const match = raw.match(/^(?[\d_]*)(?\.[\d_]*)(?.*)$/); if (!match) {