From c8fbe559c8052a29cdb566a91f1e033fe1c34ac2 Mon Sep 17 00:00:00 2001 From: fisker Date: Wed, 23 Dec 2020 17:21:29 +0800 Subject: [PATCH] Generate new snapshots --- .../consistent-function-scoping.js.md | 101 ++++ .../consistent-function-scoping.js.snap | Bin 0 -> 534 bytes test/snapshots/empty-brace-spaces.js.md | 33 ++ test/snapshots/empty-brace-spaces.js.snap | Bin 0 -> 232 bytes test/snapshots/error-message.js.md | 191 +++++++ test/snapshots/error-message.js.snap | Bin 0 -> 919 bytes test/snapshots/no-console-spaces.js.md | 226 +++++++++ test/snapshots/no-console-spaces.js.snap | Bin 0 -> 937 bytes test/snapshots/no-for-loop.js.md | 162 ++++++ test/snapshots/no-for-loop.js.snap | Bin 0 -> 720 bytes test/snapshots/no-hex-escape.js.md | 21 + test/snapshots/no-hex-escape.js.snap | Bin 0 -> 208 bytes test/snapshots/no-instanceof-array.js.md | 21 + test/snapshots/no-instanceof-array.js.snap | Bin 0 -> 203 bytes test/snapshots/no-lonely-if.js.md | 477 ++++++++++++++++++ test/snapshots/no-lonely-if.js.snap | Bin 0 -> 1467 bytes test/snapshots/no-new-buffer.js.md | 37 ++ test/snapshots/no-new-buffer.js.snap | Bin 0 -> 279 bytes .../no-object-as-default-parameter.js.md | 25 + .../no-object-as-default-parameter.js.snap | Bin 0 -> 268 bytes test/snapshots/no-process-exit.js.md | 15 + test/snapshots/no-process-exit.js.snap | Bin 0 -> 186 bytes .../no-unreadable-array-destructuring.js.md | 125 +++++ .../no-unreadable-array-destructuring.js.snap | Bin 0 -> 643 bytes test/snapshots/no-unsafe-regex.js.md | 15 + test/snapshots/no-unsafe-regex.js.snap | Bin 0 -> 172 bytes test/snapshots/no-unused-properties.js.md | 21 + test/snapshots/no-unused-properties.js.snap | Bin 0 -> 244 bytes test/snapshots/no-useless-undefined.js.md | 89 ++++ test/snapshots/no-useless-undefined.js.snap | Bin 0 -> 419 bytes test/snapshots/no-zero-fractions.js.md | 37 ++ test/snapshots/no-zero-fractions.js.snap | Bin 0 -> 269 bytes 32 files changed, 1596 insertions(+) create mode 100644 test/snapshots/consistent-function-scoping.js.md create mode 100644 test/snapshots/consistent-function-scoping.js.snap create mode 100644 test/snapshots/empty-brace-spaces.js.md create mode 100644 test/snapshots/empty-brace-spaces.js.snap create mode 100644 test/snapshots/error-message.js.md create mode 100644 test/snapshots/error-message.js.snap create mode 100644 test/snapshots/no-console-spaces.js.md create mode 100644 test/snapshots/no-console-spaces.js.snap create mode 100644 test/snapshots/no-for-loop.js.md create mode 100644 test/snapshots/no-for-loop.js.snap create mode 100644 test/snapshots/no-hex-escape.js.md create mode 100644 test/snapshots/no-hex-escape.js.snap create mode 100644 test/snapshots/no-instanceof-array.js.md create mode 100644 test/snapshots/no-instanceof-array.js.snap create mode 100644 test/snapshots/no-lonely-if.js.md create mode 100644 test/snapshots/no-lonely-if.js.snap create mode 100644 test/snapshots/no-new-buffer.js.md create mode 100644 test/snapshots/no-new-buffer.js.snap create mode 100644 test/snapshots/no-object-as-default-parameter.js.md create mode 100644 test/snapshots/no-object-as-default-parameter.js.snap create mode 100644 test/snapshots/no-process-exit.js.md create mode 100644 test/snapshots/no-process-exit.js.snap create mode 100644 test/snapshots/no-unreadable-array-destructuring.js.md create mode 100644 test/snapshots/no-unreadable-array-destructuring.js.snap create mode 100644 test/snapshots/no-unsafe-regex.js.md create mode 100644 test/snapshots/no-unsafe-regex.js.snap create mode 100644 test/snapshots/no-unused-properties.js.md create mode 100644 test/snapshots/no-unused-properties.js.snap create mode 100644 test/snapshots/no-useless-undefined.js.md create mode 100644 test/snapshots/no-useless-undefined.js.snap create mode 100644 test/snapshots/no-zero-fractions.js.md create mode 100644 test/snapshots/no-zero-fractions.js.snap diff --git a/test/snapshots/consistent-function-scoping.js.md b/test/snapshots/consistent-function-scoping.js.md new file mode 100644 index 0000000000..33f8fd5fbd --- /dev/null +++ b/test/snapshots/consistent-function-scoping.js.md @@ -0,0 +1,101 @@ +# Snapshot report for `test/consistent-function-scoping.js` + +The actual snapshot is saved in `consistent-function-scoping.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## consistent-function-scoping - #1 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + > 2 | function bar() {}␊ + | ^^^^^^^^^^^^ Move function 'bar' to the outer scope.␊ + 3 | }␊ + ` + +## consistent-function-scoping - #2 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + > 2 | async function bar() {}␊ + | ^^^^^^^^^^^^^^^^^^ Move async function 'bar' to the outer scope.␊ + 3 | }␊ + ` + +## consistent-function-scoping - #3 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + > 2 | function * bar() {}␊ + | ^^^^^^^^^^^^^^ Move generator function 'bar' to the outer scope.␊ + 3 | }␊ + ` + +## consistent-function-scoping - #4 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + > 2 | async function * bar() {}␊ + | ^^^^^^^^^^^^^^^^^^^^ Move async generator function 'bar' to the outer scope.␊ + 3 | }␊ + ` + +## consistent-function-scoping - #5 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + > 2 | const bar = () => {}␊ + | ^^ Move arrow function 'bar' to the outer scope.␊ + 3 | }␊ + ` + +## consistent-function-scoping - #6 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const doFoo = () => bar => bar;␊ + | ^^ Move arrow function to the outer scope.␊ + ` + +## consistent-function-scoping - #7 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + > 2 | const bar = async () => {}␊ + | ^^ Move async arrow function 'bar' to the outer scope.␊ + 3 | }␊ + ` + +## consistent-function-scoping - #8 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function doFoo() {␊ + > 2 | const doBar = function(bar) {␊ + | ^^^^^^^^ Move function to the outer scope.␊ + 3 | return bar;␊ + 4 | };␊ + 5 | }␊ + ` diff --git a/test/snapshots/consistent-function-scoping.js.snap b/test/snapshots/consistent-function-scoping.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..ef9f64067322188b2f102650e1651242e62f09ea GIT binary patch literal 534 zcmV+x0_puhRzVH;`T!L~ zJ&nKi;81e*7MIBjwI8oEVFZg_1>z#PeZu;hr+(Hci>|MCUD(YC5oKavXgszQj9}4x76yhdwzV1OCUnkTUvyFZzGM?n1|%xL%D}+Pzz+5SBP)X-Qy&ADYf({t zk%FPVp%s^cf}uio{l?n49_an7M(q#`>G5=#V}h~`kR7RsF4Ku!k1m-Zk| zBiA__@Hq#Z&M?C-CEp1gf-rR&Kr2Ctum&LxXX17sCudP=Noi3YEJ2%q#A-n-Q%vVi YB0onH&d(^b literal 0 HcmV?d00001 diff --git a/test/snapshots/empty-brace-spaces.js.md b/test/snapshots/empty-brace-spaces.js.md new file mode 100644 index 0000000000..7673525330 --- /dev/null +++ b/test/snapshots/empty-brace-spaces.js.md @@ -0,0 +1,33 @@ +# Snapshot report for `test/empty-brace-spaces.js` + +The actual snapshot is saved in `empty-brace-spaces.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## empty-brace-spaces - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | try {␊ + 2 | foo();␊ + 3 | } catch (error) {␊ + 4 | ␊ + 5 | }␊ + ␊ + Output:␊ + 1 | try {␊ + 2 | foo();␊ + 3 | } catch (error) {}␊ + ␊ + Error 1/1:␊ + 1 | try {␊ + 2 | foo();␊ + > 3 | } catch (error) {␊ + | ^␊ + > 4 | ␊ + | ^^^^^^^^␊ + > 5 | }␊ + | ^ Do not add spaces between braces.␊ + ` diff --git a/test/snapshots/empty-brace-spaces.js.snap b/test/snapshots/empty-brace-spaces.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..13ed1185b64ba36be9b46bf384c1be33ad7ada4f GIT binary patch literal 232 zcmV3dxBj$r%b7sYONkMVeq$CLmP`5CG(wf|PM_ z`InZEXChFqD~PFJsBef*yB$skDFDSWKpap5noB|I;-CO13voD9SivP Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error()␊ + | ^^^^^^^^^^^ Pass a message to the `Error` constructor.␊ + ` + +## error-message - #2 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw Error()␊ + | ^^^^^^^ Pass a message to the `Error` constructor.␊ + ` + +## error-message - #3 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error('')␊ + | ^^ Error message should not be an empty string.␊ + ` + +## error-message - #4 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error(``)␊ + | ^^ Error message should not be an empty string.␊ + ` + +## error-message - #5 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const err = new Error();␊ + | ^^^^^^^^^^^ Pass a message to the `Error` constructor.␊ + 2 | throw err;␊ + ` + +## error-message - #6 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | let err = 1;␊ + > 2 | err = new Error();␊ + | ^^^^^^^^^^^ Pass a message to the `Error` constructor.␊ + 3 | throw err;␊ + ` + +## error-message - #7 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | let err = new Error();␊ + | ^^^^^^^^^^^ Pass a message to the `Error` constructor.␊ + 2 | err = 1;␊ + 3 | throw err;␊ + ` + +## error-message - #8 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const foo = new TypeError()␊ + | ^^^^^^^^^^^^^^^ Pass a message to the `TypeError` constructor.␊ + ` + +## error-message - #9 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const foo = new SyntaxError()␊ + | ^^^^^^^^^^^^^^^^^ Pass a message to the `SyntaxError` constructor.␊ + ` + +## error-message - #10 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | const errorMessage = Object.freeze({errorMessage: 1}).errorMessage;␊ + > 2 | throw new Error(errorMessage)␊ + | ^^^^^^^^^^^^ Error message should be a string.␊ + ` + +## error-message - #11 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error([])␊ + | ^^ Error message should be a string.␊ + ` + +## error-message - #12 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error([foo])␊ + | ^^^^^ Error message should be a string.␊ + ` + +## error-message - #13 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error([0][0])␊ + | ^^^^^^ Error message should be a string.␊ + ` + +## error-message - #14 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error({})␊ + | ^^ Error message should be a string.␊ + ` + +## error-message - #15 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error({foo})␊ + | ^^^^^ Error message should be a string.␊ + ` + +## error-message - #16 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error({foo: 0}.foo)␊ + | ^^^^^^^^^^^^ Error message should be a string.␊ + ` + +## error-message - #17 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | throw new Error(lineNumber=2)␊ + | ^^^^^^^^^^^^ Error message should be a string.␊ + ` + +## error-message - #18 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const error = new RangeError;␊ + | ^^^^^^^^^^^^^^ Pass a message to the `RangeError` constructor.␊ + ` diff --git a/test/snapshots/error-message.js.snap b/test/snapshots/error-message.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..17e4826499edb71d95115733a8e81db08e8e0b6f GIT binary patch literal 919 zcmV;I18Dp~RzVW=K^(;r%`2PV40zoqnYvqVPX3Y3EZBh1-yqLJV>lneJ;y?vP zbM$YW&p*V+6qEV!^{F+Hj9}3oAa-%w&L`nE^TDG%+Fhk(VVfAiqH;_O3_*q~19g?< z&+h)jIlW-R5-mos=xQKNG1r~GVgE0F{cSI2OugS?zz7!gVrF2-nZIM9*pZpK$ICSI z!Z&MVU+tIV9~oky!#7FVzW~~%irl8OjqTz zbr`{-6&wr|65iFX; z$-uzOzz&W@Mpgzv#!@cVqN4mF1w(y9D=s?)LxmcJl8mDKa)rFqas{xIMs-?#zLkPO ztsaop&s7L25uW;|z#YurMSjf)ex6Q^D%2v06@CI3P^H7Yy};VAQp)5XIxUPjmKpzwv<3dz@u1}L)ee%>bU)f-EVpMC1C&MDWv8W zlvHBRko!?moC11=^o1H}tKgrMm6}|lmsXUTT9v9%jVx=WU|6fEhb&?Z^n?)>PavzI zK{?BqNJIj~lR8PYj)?q#HJ#8ptt2GSB(31C#fT`MC@i6H6iG}ySkf<|#59B@L;?;Z t+iCbpOCl0uG@e3>)Wk?cGbblAFV(L!Hz~Eq)`&{k4*+^DOOiwj0011~x5WSe literal 0 HcmV?d00001 diff --git a/test/snapshots/no-console-spaces.js.md b/test/snapshots/no-console-spaces.js.md new file mode 100644 index 0000000000..9d50486a71 --- /dev/null +++ b/test/snapshots/no-console-spaces.js.md @@ -0,0 +1,226 @@ +# Snapshot report for `test/no-console-spaces.js` + +The actual snapshot is saved in `no-console-spaces.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-console-spaces - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.log("abc", " def ", "ghi");␊ + ␊ + Output:␊ + 1 | console.log("abc", "def", "ghi");␊ + ␊ + Error 1/2:␊ + > 1 | console.log("abc", " def ", "ghi");␊ + | ^ Do not use leading space between `console.log` parameters.␊ + Error 2/2:␊ + > 1 | console.log("abc", " def ", "ghi");␊ + | ^ Do not use trailing space between `console.log` parameters.␊ + ` + +## no-console-spaces - #2 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.error(␊ + 2 | theme.error('✗'),␊ + 3 | 'Verifying "packaging" fixture\\n ',␊ + 4 | theme.error(errorMessage)␊ + 5 | );␊ + ␊ + Output:␊ + 1 | console.error(␊ + 2 | theme.error('✗'),␊ + 3 | 'Verifying "packaging" fixture\\n',␊ + 4 | theme.error(errorMessage)␊ + 5 | );␊ + ␊ + Error 1/1:␊ + 1 | console.error(␊ + 2 | theme.error('✗'),␊ + > 3 | 'Verifying "packaging" fixture\\n ',␊ + | ^ Do not use trailing space between `console.error` parameters.␊ + 4 | theme.error(errorMessage)␊ + 5 | );␊ + ` + +## no-console-spaces - #3 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.log(␊ + 2 | 'abc',␊ + 3 | 'def ',␊ + 4 | 'ghi'␊ + 5 | );␊ + ␊ + Output:␊ + 1 | console.log(␊ + 2 | 'abc',␊ + 3 | 'def',␊ + 4 | 'ghi'␊ + 5 | );␊ + ␊ + Error 1/1:␊ + 1 | console.log(␊ + 2 | 'abc',␊ + > 3 | 'def ',␊ + | ^ Do not use trailing space between `console.log` parameters.␊ + 4 | 'ghi'␊ + 5 | );␊ + ` + +## no-console-spaces - #4 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.log("_", " leading", "_")␊ + ␊ + Output:␊ + 1 | console.log("_", "leading", "_")␊ + ␊ + Error 1/1:␊ + > 1 | console.log("_", " leading", "_")␊ + | ^ Do not use leading space between `console.log` parameters.␊ + ` + +## no-console-spaces - #5 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.log("_", "trailing ", "_")␊ + ␊ + Output:␊ + 1 | console.log("_", "trailing", "_")␊ + ␊ + Error 1/1:␊ + > 1 | console.log("_", "trailing ", "_")␊ + | ^ Do not use trailing space between `console.log` parameters.␊ + ` + +## no-console-spaces - #6 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.log("_", " leading and trailing ", "_")␊ + ␊ + Output:␊ + 1 | console.log("_", "leading and trailing", "_")␊ + ␊ + Error 1/2:␊ + > 1 | console.log("_", " leading and trailing ", "_")␊ + | ^ Do not use leading space between `console.log` parameters.␊ + Error 2/2:␊ + > 1 | console.log("_", " leading and trailing ", "_")␊ + | ^ Do not use trailing space between `console.log` parameters.␊ + ` + +## no-console-spaces - #7 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.log("_", " log ", "_")␊ + ␊ + Output:␊ + 1 | console.log("_", "log", "_")␊ + ␊ + Error 1/2:␊ + > 1 | console.log("_", " log ", "_")␊ + | ^ Do not use leading space between `console.log` parameters.␊ + Error 2/2:␊ + > 1 | console.log("_", " log ", "_")␊ + | ^ Do not use trailing space between `console.log` parameters.␊ + ` + +## no-console-spaces - #8 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.debug("_", " debug ", "_")␊ + ␊ + Output:␊ + 1 | console.debug("_", "debug", "_")␊ + ␊ + Error 1/2:␊ + > 1 | console.debug("_", " debug ", "_")␊ + | ^ Do not use leading space between `console.debug` parameters.␊ + Error 2/2:␊ + > 1 | console.debug("_", " debug ", "_")␊ + | ^ Do not use trailing space between `console.debug` parameters.␊ + ` + +## no-console-spaces - #9 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.info("_", " info ", "_")␊ + ␊ + Output:␊ + 1 | console.info("_", "info", "_")␊ + ␊ + Error 1/2:␊ + > 1 | console.info("_", " info ", "_")␊ + | ^ Do not use leading space between `console.info` parameters.␊ + Error 2/2:␊ + > 1 | console.info("_", " info ", "_")␊ + | ^ Do not use trailing space between `console.info` parameters.␊ + ` + +## no-console-spaces - #10 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.warn("_", " warn ", "_")␊ + ␊ + Output:␊ + 1 | console.warn("_", "warn", "_")␊ + ␊ + Error 1/2:␊ + > 1 | console.warn("_", " warn ", "_")␊ + | ^ Do not use leading space between `console.warn` parameters.␊ + Error 2/2:␊ + > 1 | console.warn("_", " warn ", "_")␊ + | ^ Do not use trailing space between `console.warn` parameters.␊ + ` + +## no-console-spaces - #11 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | console.error("_", " error ", "_")␊ + ␊ + Output:␊ + 1 | console.error("_", "error", "_")␊ + ␊ + Error 1/2:␊ + > 1 | console.error("_", " error ", "_")␊ + | ^ Do not use leading space between `console.error` parameters.␊ + Error 2/2:␊ + > 1 | console.error("_", " error ", "_")␊ + | ^ Do not use trailing space between `console.error` parameters.␊ + ` diff --git a/test/snapshots/no-console-spaces.js.snap b/test/snapshots/no-console-spaces.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..9952aedd00eafdb4944e8e07439a0d50c4b2d63a GIT binary patch literal 937 zcmV;a16KS&RzV=IBfCBO#khX9-^dE}|00000000A1 zVPs(7W?+-vzub3*;GRnUXZhm8nCvD{TA-Yn5Z*3MMSac>c z1B1$(_T}rdxNYmWiz=qG`0r%|i)ynnFnD_Fo&T2lGx6f#pUFEnYdJH5MfKSj7?yuj zI@sqLvrh3{?gD+yqca)7qFdM*7*=m><^2`%^@7q`LB60)QF}(Ps0$|p!v@)@FRvfD z<@?4b;S4mkOdKR52 zvhHpLcReFmbRjPT!orU@`GFf*`&!-J8PL6Av^iOVyuptQt_OF_XQe*NI z)Imy3&`kl8zNy8hmcv~&$=j&TKvD;VkPay%tfe8u)iA9OIsU@jJ#d;+8 z8zq5cGGb34Ir-@tO7TiM3Q7ti1M;IW0ZaPC z84qMRhB|o$B}Tq75XuQ~8;H&gFdZ0CVu(96V%S2}P{5xm%W$O1%)GRGSQLTSghBvG zJ%~v-MdGvor{_sYjvy0>OpT;Fg!DMTbPh@+G~z3g6O)p`Zc9l`13N7}BU1@?#fq#2 zr~_F8{=ylDHPk5`NGzjCb_4=ip%i4k)=IRw^fQwJs+bwtAvlz0%WLv>&pQYY9f#cv#L({Q#cu^4EF?ml>9 zk+Kww-DyM>_T`C1d9X+Zu?eMWB=sOB;WUlY0-TA6lmrbjk;wE+xP literal 0 HcmV?d00001 diff --git a/test/snapshots/no-for-loop.js.md b/test/snapshots/no-for-loop.js.md new file mode 100644 index 0000000000..13fcb9acbf --- /dev/null +++ b/test/snapshots/no-for-loop.js.md @@ -0,0 +1,162 @@ +# Snapshot report for `test/no-for-loop.js` + +The actual snapshot is saved in `no-for-loop.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-for-loop - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | for (let i = 0; i < arr.length; i += 1) {␊ + 2 | console.log(arr[i])␊ + 3 | }␊ + ␊ + Output:␊ + 1 | for (const element of arr) {␊ + 2 | console.log(element)␊ + 3 | }␊ + ␊ + Error 1/1:␊ + > 1 | for (let i = 0; i < arr.length; i += 1) {␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `for-of` loop instead of this `for` loop.␊ + 2 | console.log(arr[i])␊ + 3 | }␊ + ` + +## no-for-loop - #2 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | for (let i = 0; i < plugins.length; i++) {␊ + 2 | let plugin = plugins[i];␊ + 3 | plugin = calculateSomeNewValue();␊ + 4 | // ...␊ + 5 | }␊ + ␊ + Output:␊ + 1 | for (let plugin of plugins) {␊ + 2 | plugin = calculateSomeNewValue();␊ + 3 | // ...␊ + 4 | }␊ + ␊ + Error 1/1:␊ + > 1 | for (let i = 0; i < plugins.length; i++) {␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `for-of` loop instead of this `for` loop.␊ + 2 | let plugin = plugins[i];␊ + 3 | plugin = calculateSomeNewValue();␊ + 4 | // ...␊ + 5 | }␊ + ` + +## no-for-loop - #3 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | for (␊ + 2 | let i = 0;␊ + 3 | i < array.length;␊ + 4 | i++␊ + 5 | )␊ + 6 | // comment (foo)␊ + 7 | {␊ + 8 | var foo = array[i];␊ + 9 | foo = bar();␊ + 10 | }␊ + ␊ + Output:␊ + 1 | for (␊ + 2 | var foo of array␊ + 3 | )␊ + 4 | // comment (foo)␊ + 5 | {␊ + 6 | foo = bar();␊ + 7 | }␊ + ␊ + Error 1/1:␊ + > 1 | for (␊ + | ^^^^^␊ + > 2 | let i = 0;␊ + | ^^^^^^^^^^^␊ + > 3 | i < array.length;␊ + | ^^^^^^^^^^^␊ + > 4 | i++␊ + | ^^^^^^^^^^^␊ + > 5 | )␊ + | ^^ Use a `for-of` loop instead of this `for` loop.␊ + 6 | // comment (foo)␊ + 7 | {␊ + 8 | var foo = array[i];␊ + 9 | foo = bar();␊ + 10 | }␊ + ` + +## no-for-loop - #4 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | for (let i = 0; i < array.length; i++) {␊ + 2 | let foo = array[i];␊ + 3 | }␊ + ␊ + Output:␊ + 1 | for (let foo of array) {␊ + 2 | }␊ + ␊ + Error 1/1:␊ + > 1 | for (let i = 0; i < array.length; i++) {␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `for-of` loop instead of this `for` loop.␊ + 2 | let foo = array[i];␊ + 3 | }␊ + ` + +## no-for-loop - #5 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | for (let i = 0; i < array.length; i++) {␊ + 2 | const foo = array[i];␊ + 3 | }␊ + ␊ + Output:␊ + 1 | for (const foo of array) {␊ + 2 | }␊ + ␊ + Error 1/1:␊ + > 1 | for (let i = 0; i < array.length; i++) {␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `for-of` loop instead of this `for` loop.␊ + 2 | const foo = array[i];␊ + 3 | }␊ + ` + +## no-for-loop - #6 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | for (let i = 0; i < array.length; i++) {␊ + 2 | var foo = array[i], bar = 1;␊ + 3 | }␊ + ␊ + Output:␊ + 1 | for (var foo of array) {␊ + 2 | var bar = 1;␊ + 3 | }␊ + ␊ + Error 1/1:␊ + > 1 | for (let i = 0; i < array.length; i++) {␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `for-of` loop instead of this `for` loop.␊ + 2 | var foo = array[i], bar = 1;␊ + 3 | }␊ + ` diff --git a/test/snapshots/no-for-loop.js.snap b/test/snapshots/no-for-loop.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..b3112c7711051c08c635d2aaf3ce87e4c99ea8bf GIT binary patch literal 720 zcmV;>0x$hRRzVD~gH^Gp7?;nc@00000000A9 z#K6G7#=!FD#-rJ1eQL}jJ}l%fx?;)500LD&ilh6>ffu)A^t-z)I`++o>|_LszF}ry z2zwIn=uX^|KbM#I9q3ldzsLv{bzo&+$W%0~yHHx-U)Sor@pPyEB}TC5EH(y)M%iDd zye%{TJ$ z1evlKxjgdJp@tbvq`LSj)-Vx?YAYF>It22ey> zTT`JLsN4vsoU<&k2&g9?s2Hp&Ix|*BAqgmEt6*piRAUTOQ_IEWUs{502TWsr8bl|W znV4p{78L>Y8R{EaaoLgTR0W{&IHG_;XmP4SqCx`DaNYd01cjXZ`~ro{yyBA7#1xQQ zOENNx!Lkr3J(9u!CFGNt5FwB74~PRc5aBV95J*2Kh6h11CSVzDZ4lcO$kqfg%zzAi zeTC%w+}zZ>5(N#Q%fRC1AjRMSu>i5KxEgGxC0G(70rZ51CP>uK03?b%GSNc;7O7C5 zgX}iJ?j%!~i_EauX%4j#CGJrJ3m&x~87v`(7WE)ixC0Z5V&w3}A`K66h#VQoho+H* zlHyz`%&@m*1DniE)3|IW#MG4veM1*WX zPH8&ORy^qyq5`M`suamSPPklhVoq{tPGU)FaDHy8Uut<+Voqr)BqM>dKQMRd>FGgB zE8J-vY97%0P|J|qLX2I;D0Z2U5T7{1f%q7uEU(Zam{C$g266ce5dsR@z^WH5qvhwM z>gD98YXB7j9jHk}HcQP(1sBSYtcJrls3Iiuh|Pppol8QTQIZXD1qJ|%ZFxSy3IG6e CZ$2sj literal 0 HcmV?d00001 diff --git a/test/snapshots/no-hex-escape.js.md b/test/snapshots/no-hex-escape.js.md new file mode 100644 index 0000000000..9a62f9d512 --- /dev/null +++ b/test/snapshots/no-hex-escape.js.md @@ -0,0 +1,21 @@ +# Snapshot report for `test/no-hex-escape.js` + +The actual snapshot is saved in `no-hex-escape.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-hex-escape - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | const foo = "\\xb1"␊ + ␊ + Output:␊ + 1 | const foo = "\\u00b1"␊ + ␊ + Error 1/1:␊ + > 1 | const foo = "\\xb1"␊ + | ^^^^^^ Use Unicode escapes instead of hexadecimal escapes.␊ + ` diff --git a/test/snapshots/no-hex-escape.js.snap b/test/snapshots/no-hex-escape.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..388c6810256b41fdf3686aedf42b8b350ec6a773 GIT binary patch literal 208 zcmV;>05AVRRzVzW@caqvl&?#1evxoaCznxl$Ka=DJU2! z)F>q9=M|SIq~+%;*eWQ+R3sTHadG*Vmf%!TYG43X<62adU!-8DZ)nA3hsz)ZAgED5 z2614Z5L%q75So{noS%}akXoFaSddz*kO|bDnwX-HpQezJT9KHNnw*)Nm;;m6;{pIl KWGpr20002Z%U4wZ literal 0 HcmV?d00001 diff --git a/test/snapshots/no-instanceof-array.js.md b/test/snapshots/no-instanceof-array.js.md new file mode 100644 index 0000000000..c48666a737 --- /dev/null +++ b/test/snapshots/no-instanceof-array.js.md @@ -0,0 +1,21 @@ +# Snapshot report for `test/no-instanceof-array.js` + +The actual snapshot is saved in `no-instanceof-array.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-instanceof-array - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (arr instanceof Array) {}␊ + ␊ + Output:␊ + 1 | if (Array.isArray(arr)) {}␊ + ␊ + Error 1/1:␊ + > 1 | if (arr instanceof Array) {}␊ + | ^^^^^^^^^^^^^^^^^^^^ Use `Array.isArray()` instead of `instanceof Array`.␊ + ` diff --git a/test/snapshots/no-instanceof-array.js.snap b/test/snapshots/no-instanceof-array.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..fb1a9032633d1c7716d793b492520fabdc1a7ded GIT binary patch literal 203 zcmV;+05tzWRzV Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) {␊ + 2 | if (b) {␊ + 3 | }␊ + 4 | }␊ + ␊ + Output:␊ + 1 | if (a && b) {␊ + 2 | }␊ + ␊ + Error 1/1:␊ + 1 | if (a) {␊ + > 2 | if (b) {␊ + | ^^^^^^^^␊ + > 3 | }␊ + | ^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 4 | }␊ + ` + +## no-lonely-if - #2 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) if (b) {␊ + 2 | foo();␊ + 3 | }␊ + ␊ + Output:␊ + 1 | if (a && b) {␊ + 2 | foo();␊ + 3 | }␊ + ␊ + Error 1/1:␊ + > 1 | if (a) if (b) {␊ + | ^^^^^^^^␊ + > 2 | foo();␊ + | ^^^^^^^␊ + > 3 | }␊ + | ^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + ` + +## no-lonely-if - #3 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) {␊ + 2 | if (b) foo();␊ + 3 | }␊ + ␊ + Output:␊ + 1 | if (a && b) foo();␊ + ␊ + Error 1/1:␊ + 1 | if (a) {␊ + > 2 | if (b) foo();␊ + | ^^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 3 | }␊ + ` + +## no-lonely-if - #4 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) if (b) foo();␊ + ␊ + Output:␊ + 1 | if (a && b) foo();␊ + ␊ + Error 1/1:␊ + > 1 | if (a) if (b) foo();␊ + | ^^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + ` + +## no-lonely-if - #5 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) if (b);␊ + ␊ + Output:␊ + 1 | if (a && b) ;␊ + ␊ + Error 1/1:␊ + > 1 | if (a) if (b);␊ + | ^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + ` + +## no-lonely-if - #6 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) {␊ + 2 | if (b) {␊ + 3 | // Should not report␊ + 4 | }␊ + 5 | } else if (c) {␊ + 6 | if (d) {␊ + 7 | }␊ + 8 | }␊ + ␊ + Output:␊ + 1 | if (a) {␊ + 2 | if (b) {␊ + 3 | // Should not report␊ + 4 | }␊ + 5 | } else if (c && d) {␊ + 6 | }␊ + ␊ + Error 1/1:␊ + 1 | if (a) {␊ + 2 | if (b) {␊ + 3 | // Should not report␊ + 4 | }␊ + 5 | } else if (c) {␊ + > 6 | if (d) {␊ + | ^^^^^^^^␊ + > 7 | }␊ + | ^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 8 | }␊ + ` + +## no-lonely-if - #7 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + 5 | if (a = b)␊ + 6 | if (a += b)␊ + 7 | if (a -= b)␊ + 8 | if (a &&= b)␊ + 9 | if (yield a)␊ + 10 | if (a, b);␊ + 11 | }␊ + ␊ + Output:␊ + 1 | function * foo() {␊ + 2 | if ((a || b) && (a ?? b) && (a ? b : c) && (a = b) && (a += b) && (a -= b) && (a &&= b) && (yield a) && (a, b))␊ + 3 | ;␊ + 4 | }␊ + ␊ + Error 1/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + > 3 | if (a ?? b)␊ + | ^^^^^^^^^^^␊ + > 4 | if (a ? b : c)␊ + | ^^^^^^^^^^^^^^^␊ + > 5 | if (a = b)␊ + | ^^^^^^^^^^^^^^^␊ + > 6 | if (a += b)␊ + | ^^^^^^^^^^^^^^^␊ + > 7 | if (a -= b)␊ + | ^^^^^^^^^^^^^^^␊ + > 8 | if (a &&= b)␊ + | ^^^^^^^^^^^^^^^␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 2/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + > 4 | if (a ? b : c)␊ + | ^^^^^^^^^^^^^^␊ + > 5 | if (a = b)␊ + | ^^^^^^^^^^^␊ + > 6 | if (a += b)␊ + | ^^^^^^^^^^^␊ + > 7 | if (a -= b)␊ + | ^^^^^^^^^^^␊ + > 8 | if (a &&= b)␊ + | ^^^^^^^^^^^␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 3/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + > 5 | if (a = b)␊ + | ^^^^^^^^^^␊ + > 6 | if (a += b)␊ + | ^^^^^^^^^^^^␊ + > 7 | if (a -= b)␊ + | ^^^^^^^^^^^^␊ + > 8 | if (a &&= b)␊ + | ^^^^^^^^^^^^␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 4/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + 5 | if (a = b)␊ + > 6 | if (a += b)␊ + | ^^^^^^^^^^^␊ + > 7 | if (a -= b)␊ + | ^^^^^^^^^^^^␊ + > 8 | if (a &&= b)␊ + | ^^^^^^^^^^^^␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 5/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + 5 | if (a = b)␊ + 6 | if (a += b)␊ + > 7 | if (a -= b)␊ + | ^^^^^^^^^^^␊ + > 8 | if (a &&= b)␊ + | ^^^^^^^^^^^^^␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 6/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + 5 | if (a = b)␊ + 6 | if (a += b)␊ + 7 | if (a -= b)␊ + > 8 | if (a &&= b)␊ + | ^^^^^^^^^^^^␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 7/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + 5 | if (a = b)␊ + 6 | if (a += b)␊ + 7 | if (a -= b)␊ + 8 | if (a &&= b)␊ + > 9 | if (yield a)␊ + | ^^^^^^^^^^^^␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + Error 8/8:␊ + 1 | function * foo() {␊ + 2 | if (a || b)␊ + 3 | if (a ?? b)␊ + 4 | if (a ? b : c)␊ + 5 | if (a = b)␊ + 6 | if (a += b)␊ + 7 | if (a -= b)␊ + 8 | if (a &&= b)␊ + 9 | if (yield a)␊ + > 10 | if (a, b);␊ + | ^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 11 | }␊ + ` + +## no-lonely-if - #8 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | async function foo() {␊ + 2 | if (a)␊ + 3 | if (await a)␊ + 4 | if (a.b)␊ + 5 | if (a && b);␊ + 6 | }␊ + ␊ + Output:␊ + 1 | async function foo() {␊ + 2 | if (a && await a && a.b && a && b)␊ + 3 | ;␊ + 4 | }␊ + ␊ + Error 1/3:␊ + 1 | async function foo() {␊ + 2 | if (a)␊ + > 3 | if (await a)␊ + | ^^^^^^^^^^^^␊ + > 4 | if (a.b)␊ + | ^^^^^^^^^␊ + > 5 | if (a && b);␊ + | ^^^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 6 | }␊ + Error 2/3:␊ + 1 | async function foo() {␊ + 2 | if (a)␊ + 3 | if (await a)␊ + > 4 | if (a.b)␊ + | ^^^^^^^^␊ + > 5 | if (a && b);␊ + | ^^^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 6 | }␊ + Error 3/3:␊ + 1 | async function foo() {␊ + 2 | if (a)␊ + 3 | if (await a)␊ + 4 | if (a.b)␊ + > 5 | if (a && b);␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 6 | }␊ + ` + +## no-lonely-if - #9 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (((a || b))) if (((c || d)));␊ + ␊ + Output:␊ + 1 | if ((((a || b) && (c || d)))) ;␊ + ␊ + Error 1/1:␊ + > 1 | if (((a || b))) if (((c || d)));␊ + | ^^^^^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + ` + +## no-lonely-if - #10 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if /* will keep */␊ + 2 | (␊ + 3 | /* will keep */␊ + 4 | a /* will keep */␊ + 5 | .b /* will keep */␊ + 6 | ) /* keep */{␊ + 7 | /* will remove */␊ + 8 | if (␊ + 9 | /* will remove */␊ + 10 | c /* will keep */␊ + 11 | .d /* will remove */␊ + 12 | ) {␊ + 13 | /* will keep */␊ + 14 | foo();␊ + 15 | /* will keep */␊ + 16 | }␊ + 17 | /* will remove */␊ + 18 | }␊ + ␊ + Output:␊ + 1 | if /* will keep */␊ + 2 | (␊ + 3 | /* will keep */␊ + 4 | a /* will keep */␊ + 5 | .b && c /* will keep */␊ + 6 | .d /* will keep */␊ + 7 | ) /* keep */{␊ + 8 | /* will keep */␊ + 9 | foo();␊ + 10 | /* will keep */␊ + 11 | }␊ + ␊ + Error 1/1:␊ + 1 | if /* will keep */␊ + 2 | (␊ + 3 | /* will keep */␊ + 4 | a /* will keep */␊ + 5 | .b /* will keep */␊ + 6 | ) /* keep */{␊ + 7 | /* will remove */␊ + > 8 | if (␊ + | ^^^^␊ + > 9 | /* will remove */␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 10 | c /* will keep */␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 11 | .d /* will remove */␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 12 | ) {␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 13 | /* will keep */␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 14 | foo();␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 15 | /* will keep */␊ + | ^^^^^^^^^^^^^^^^^^^␊ + > 16 | }␊ + | ^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 17 | /* will remove */␊ + 18 | }␊ + ` + +## no-lonely-if - #11 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a) {␊ + 2 | if (b) foo()␊ + 3 | }␊ + 4 | [].forEach(bar)␊ + ␊ + Output:␊ + 1 | if (a && b) foo();␊ + 2 | [].forEach(bar)␊ + ␊ + Error 1/1:␊ + 1 | if (a) {␊ + > 2 | if (b) foo()␊ + | ^^^^^^^^^^^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + 3 | }␊ + 4 | [].forEach(bar)␊ + ` + +## no-lonely-if - #12 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | if (a)␊ + 2 | if (b) foo()␊ + 3 | ;[].forEach(bar)␊ + ␊ + Output:␊ + 1 | if (a && b)␊ + 2 | foo()␊ + 3 | ;[].forEach(bar)␊ + ␊ + Error 1/1:␊ + 1 | if (a)␊ + > 2 | if (b) foo()␊ + | ^^^^^^^^^^^^␊ + > 3 | ;[].forEach(bar)␊ + | ^^ Unexpected `if` as the only statement in a `if` block without `else`.␊ + ` diff --git a/test/snapshots/no-lonely-if.js.snap b/test/snapshots/no-lonely-if.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..b95c2cff4758816131e34ee9af81b367eba2663b GIT binary patch literal 1467 zcmV;s1w{HmRzVz1gtYVdJ;E@gIu_00000000B! zSzTxxRTRF{klI;lijiVdsoWyO-Nfv6vdLym%m#%#sHhJ?qzw(3-JNBZY<9wCVoZ}D z7U_dVB|aGt5ky3#)}Iiig~k*@Q`#bxQ0fmALLcgzf`XA!oVoL}^KWYio!@+CXYzy9TtYfl{-akls-J`E*CVBsu9FY^wQud}Cx72q zZ~TlS)}|c@b^J2<#iy5!{CY9+_Wb?w$8nBWKdeXSnVSzSHVl3<_WkF3SNpD>-r$J! zr=19i7j`8E7CLV{@#DGG{>`ILbHuu57ecwE^S7enmoFaw`bxav=A6h8>n$FkGbh5w z<~rYMIk5NV{Kn*g0!OUZLI^F7ZZ>>$`P}=V;o57b7k;?3czpIex7a>%h9lNj_an5ivKG63a_Px@(|gVNE6<+g zi1qac5xV{E;J54hAD{dEyYg2@-Z=FzN36>jp*nOAVT!9q_w8upLQj>(CY0_F#sZ$f zg&Yox5%QIe;Az#`u3Gt=EQcdKYAdd`W<#OpClq%l+}w;=UHZ#qxr~LF&>c!qroyV# z_zW2z)z>+i=2Lm5k8N7<3nl60F)5=+Sv*|G4P$W}D|rdarQ#GGS42e`l}ZXOl(48j zPZ#CP2%an`d3i#?!%}fv8jgk>1pS6Uf-IQE^8FKJc-r}Jjhuo<)-duz_D?`~%|$zK zPuDqdi{n$J49-oIGD<-%>8o~)z6L97Ovzugx%p2tgt$*I_UN)K|^A~0Qv0! zFdhIvceK(0@ioNb$iy&QqQMGe<+6@r@MttAm;1#`KAaZI5g%nqAJfyXs$x}Bf>`hz zv^9gYF-Yt2&z574qjsl|=9e;~>UhSjd|ct9Pln8hVo!DVSoE-Pjd z%^J0S7Hd>LLe*YPgM+Tg&pc5ek6S(CLFwAgk7`$1x6Mo(E|!`fMI-OwgLnhd zQ9L0EBW=qLWYzOk8^Bjw4_nq!;Ai8V25{)6ES)97r-#Si{cNM1?;*?GwUpw|3*SaOv zm6dr}z2iLo(pHR#F|bjbG_@0g}Sa-i`utX#3Pb4hFfB0kqBFr z0dOGIL4>-J0>MYq&@-)4M6?HnZQ3dorgK>um0yw!cdKAng#z@`%LShSW+d6otINq^ zuqTm5S4D_BCa{e`uvY#X6gp{+2~$Xcib?Rid#tevYN$fQ=tbK>jO}3;q*Iat+fb&$ z&mkH=0+cM Snapshot 1 + + `␊ + Input:␊ + 1 | const buf = new Buffer()␊ + ␊ + Output:␊ + 1 | const buf = Buffer.from()␊ + ␊ + Error 1/1:␊ + > 1 | const buf = new Buffer()␊ + | ^^^^^^^^^^^^ `new Buffer()` is deprecated, use `Buffer.from()` instead.␊ + ` + +## no-new-buffer - #2 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | const buf = new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72])␊ + ␊ + Output:␊ + 1 | const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72])␊ + ␊ + Error 1/1:␊ + > 1 | const buf = new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72])␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `new Buffer()` is deprecated, use `Buffer.from()` instead.␊ + ` diff --git a/test/snapshots/no-new-buffer.js.snap b/test/snapshots/no-new-buffer.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..39500f26ecdb92d2e41ce7576cdd3edf3c32efa8 GIT binary patch literal 279 zcmV+y0qFigRzVb0s d9S%eqMr>FSXB__UBnD6t<^Yv|yY7+#004V`aGd}E literal 0 HcmV?d00001 diff --git a/test/snapshots/no-object-as-default-parameter.js.md b/test/snapshots/no-object-as-default-parameter.js.md new file mode 100644 index 0000000000..34c2b3ce07 --- /dev/null +++ b/test/snapshots/no-object-as-default-parameter.js.md @@ -0,0 +1,25 @@ +# Snapshot report for `test/no-object-as-default-parameter.js` + +The actual snapshot is saved in `no-object-as-default-parameter.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-object-as-default-parameter - #1 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | function abc(foo = {a: 123}) {}␊ + | ^^^ Do not use an object literal as default for parameter `foo`.␊ + ` + +## no-object-as-default-parameter - #2 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const abc = (foo = {a: false}) => {};␊ + | ^^^ Do not use an object literal as default for parameter `foo`.␊ + ` diff --git a/test/snapshots/no-object-as-default-parameter.js.snap b/test/snapshots/no-object-as-default-parameter.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..a8faa52f15de4ea46ce7e183dad271e6aec43371 GIT binary patch literal 268 zcmV+n0rUPrRzVd=B=28HH8U+*(7Z<1ClCO}LU!qW2oT`wRr;wkNm6}|lkds-GT9lZh zkXWpclA4xSnp2{X2DGyvu_!S&6)2^U0JJ7Sj|;_VZCIR^R+^Vwl9`_eavhS>42_I| S4y&%EiK76hq>27&0RRB`EOOxh literal 0 HcmV?d00001 diff --git a/test/snapshots/no-process-exit.js.md b/test/snapshots/no-process-exit.js.md new file mode 100644 index 0000000000..0aec16a5b2 --- /dev/null +++ b/test/snapshots/no-process-exit.js.md @@ -0,0 +1,15 @@ +# Snapshot report for `test/no-process-exit.js` + +The actual snapshot is saved in `no-process-exit.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-process-exit - #1 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | process.exit(1);␊ + | ^^^^^^^^^^^^^^^ Only use `process.exit()` in CLI apps. Throw an error instead.␊ + ` diff --git a/test/snapshots/no-process-exit.js.snap b/test/snapshots/no-process-exit.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..5fcaacf532e8ac857142cbcc7bcab342ea480231 GIT binary patch literal 186 zcmZ<^b5sb>!t~b7V_O33}C<>0Mv6=#LVsbFH(so;9m;t5j># zqCZcrJWASorR$6kud{Eq9;?ENzz%0tu78!5Q@NHNUCG6%A!Q;gV)R*LPOXio5I0xX mR}m+pu1}{$g+7Y}9sHK^OmzAZwPh~~85x2SHbyQ3ItT#Zb4UgN literal 0 HcmV?d00001 diff --git a/test/snapshots/no-unreadable-array-destructuring.js.md b/test/snapshots/no-unreadable-array-destructuring.js.md new file mode 100644 index 0000000000..4df427f049 --- /dev/null +++ b/test/snapshots/no-unreadable-array-destructuring.js.md @@ -0,0 +1,125 @@ +# Snapshot report for `test/no-unreadable-array-destructuring.js` + +The actual snapshot is saved in `no-unreadable-array-destructuring.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-unreadable-array-destructuring - #1 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const [,, foo] = parts;␊ + | ^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #2 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const [foo,,, bar] = parts;␊ + | ^^^^^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #3 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const [foo,,,] = parts;␊ + | ^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #4 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const [foo, bar,, baz ,,, qux] = parts;␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #5 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | [,, foo] = bar;␊ + | ^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #6 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | ({parts: [,, foo]} = bar);␊ + | ^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #7 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | function foo([,, bar]) {}␊ + | ^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #8 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | function foo([bar,,, baz]) {}␊ + | ^^^^^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #9 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | function foo([bar,,,]) {}␊ + | ^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #10 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | function foo([bar, baz,, qux ,,, quux]) {}␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #11 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const [,,...rest] = parts;␊ + | ^^^^^^^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` + +## no-unreadable-array-destructuring - #12 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const [,,,] = parts;␊ + | ^^^^^ Array destructuring may not contain consecutive ignored values.␊ + ` diff --git a/test/snapshots/no-unreadable-array-destructuring.js.snap b/test/snapshots/no-unreadable-array-destructuring.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..0aef7d7ed4c8c9e08379c9c178c023c1fd7a57e7 GIT binary patch literal 643 zcmV-}0(|{JRzVPRbT_1}G00000000BC zV`O09VNkcNtM(SuWllL>cYWr$7YBiYKrju69e5+NJ|(GFWV{Of7sjeGjS(!W1ytZR zPcWmRJVp136+`Qx_0v=s!J;RDxWYSqfv9$os3}7FeV0uO176tH>UjK zko>z`{iWh$5k|1+D;kUX!ML67(-}E2PeCFQS#0VCB3dFanQesMll5ds0F}%VUd5M=1ESkc`z;Ji* z*2yO3+Kk*kt(GPR+*r&A78PP=U|?oo2Zt0RD}x|YI|G+%QBi)8f}y^l6_=fYp+b#9 za(-TMi9&Q*e!h;5jzUsmQLKWkLP26tNwGDT0uaT4`Q#NoIZ?$UPd-K*vA=tSVMhp}H2` zSu_nY#(DzrNFWYrAAeBS=;-L_=@kL3A)KhF>!uDOjAS#Wa0O}^VN<2}FH?`3_TA^haU85CGc7&E*bj*&7g_w>(at1JPV2+?o5}%L1 dj!^*TJ5UOTrtJzM>Km%2YXFP`446;|0059`ABg|} literal 0 HcmV?d00001 diff --git a/test/snapshots/no-unsafe-regex.js.md b/test/snapshots/no-unsafe-regex.js.md new file mode 100644 index 0000000000..df00483a17 --- /dev/null +++ b/test/snapshots/no-unsafe-regex.js.md @@ -0,0 +1,15 @@ +# Snapshot report for `test/no-unsafe-regex.js` + +The actual snapshot is saved in `no-unsafe-regex.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-unsafe-regex - #1 + +> Snapshot 1 + + `␊ + Error 1/1:␊ + > 1 | const foo = /(x+x+)+y/g␊ + | ^^^^^^^^^^^ Unsafe regular expression.␊ + ` diff --git a/test/snapshots/no-unsafe-regex.js.snap b/test/snapshots/no-unsafe-regex.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..b288cb42b63ba9d382e1b9a2e8a37912a6be3aca GIT binary patch literal 172 zcmZ<^b5sb Snapshot 1 + + `␊ + Error 1/1:␊ + 1 | function foo() {␊ + 2 | const bar = {␊ + 3 | b: 2,␊ + > 4 | u: 3␊ + | ^^^^ Property `u` is defined but never used.␊ + 5 | };␊ + 6 | console.log(bar.b);␊ + 7 | }␊ + ` diff --git a/test/snapshots/no-unused-properties.js.snap b/test/snapshots/no-unused-properties.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..b8bd496e7cbcca5b0e3fd1f2322e975f2e853339 GIT binary patch literal 244 zcmV uP0<5tG6iX>wFa`xVAkd5r0V75r)vN$)l1R@NtpwsYPkSUY`7ET0001!J7dHE literal 0 HcmV?d00001 diff --git a/test/snapshots/no-useless-undefined.js.md b/test/snapshots/no-useless-undefined.js.md new file mode 100644 index 0000000000..a287c9ee5d --- /dev/null +++ b/test/snapshots/no-useless-undefined.js.md @@ -0,0 +1,89 @@ +# Snapshot report for `test/no-useless-undefined.js` + +The actual snapshot is saved in `no-useless-undefined.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-useless-undefined - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | foo(␊ + 2 | undefined,␊ + 3 | bar,␊ + 4 | undefined,␊ + 5 | undefined,␊ + 6 | undefined,␊ + 7 | undefined,␊ + 8 | )␊ + ␊ + Output:␊ + 1 | foo(␊ + 2 | undefined,␊ + 3 | bar,␊ + 4 | )␊ + ␊ + Error 1/1:␊ + 1 | foo(␊ + 2 | undefined,␊ + 3 | bar,␊ + > 4 | undefined,␊ + | ^^^^^^^^^^␊ + > 5 | undefined,␊ + | ^^^^^^^^^^^␊ + > 6 | undefined,␊ + | ^^^^^^^^^^^␊ + > 7 | undefined,␊ + | ^^^^^^^^^^^ Do not use useless `undefined`.␊ + 8 | )␊ + ` + +## no-useless-undefined - #2 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | function foo([bar = undefined] = []) {}␊ + ␊ + Output:␊ + 1 | function foo([bar] = []) {}␊ + ␊ + Error 1/1:␊ + > 1 | function foo([bar = undefined] = []) {}␊ + | ^^^^^^^^^ Do not use useless `undefined`.␊ + ` + +## no-useless-undefined - #3 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | foo(bar, undefined, undefined);␊ + ␊ + Output:␊ + 1 | foo(bar);␊ + ␊ + Error 1/1:␊ + > 1 | foo(bar, undefined, undefined);␊ + | ^^^^^^^^^^^^^^^^^^^^ Do not use useless `undefined`.␊ + ` + +## no-useless-undefined - #4 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | let a = undefined, b = 2;␊ + ␊ + Output:␊ + 1 | let a, b = 2;␊ + ␊ + Error 1/1:␊ + > 1 | let a = undefined, b = 2;␊ + | ^^^^^^^^^ Do not use useless `undefined`.␊ + ` diff --git a/test/snapshots/no-useless-undefined.js.snap b/test/snapshots/no-useless-undefined.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..6cffbb7350c5d50557699fe159fe802e883b7829 GIT binary patch literal 419 zcmV;U0bKq;RzVlqD=cE=FDRM%pJHM%xrrAUEmN0KEFKVk#K`x?c!E75$LlUkyXh-|rz zLK2W`WR31WutJ0+hL3O?gz5(}-Mtq*mVn^~N`uJu!I_#Eu7@hu#O88BMxn()92P*( NF91kmE((_f003pbxS0R| literal 0 HcmV?d00001 diff --git a/test/snapshots/no-zero-fractions.js.md b/test/snapshots/no-zero-fractions.js.md new file mode 100644 index 0000000000..7573b6b3b3 --- /dev/null +++ b/test/snapshots/no-zero-fractions.js.md @@ -0,0 +1,37 @@ +# Snapshot report for `test/no-zero-fractions.js` + +The actual snapshot is saved in `no-zero-fractions.js.snap`. + +Generated by [AVA](https://avajs.dev). + +## no-zero-fractions - #1 + +> Snapshot 1 + + `␊ + Input:␊ + 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.␊ + ` + +## no-zero-fractions - #2 + +> Snapshot 1 + + `␊ + Input:␊ + 1 | const foo = (1.).toString()␊ + ␊ + Output:␊ + 1 | const foo = (1).toString()␊ + ␊ + Error 1/1:␊ + > 1 | const foo = (1.).toString()␊ + | ^^ Don't use a dangling dot in the number.␊ + ` diff --git a/test/snapshots/no-zero-fractions.js.snap b/test/snapshots/no-zero-fractions.js.snap new file mode 100644 index 0000000000000000000000000000000000000000..be4a950d34c293ffe0febad7611ed48ccef2c939 GIT binary patch literal 269 zcmV+o0rLJqRzVSc#C?x0S6_+Ta<>xEdDrgw$Y3h~a2bUCO=A~