diff --git a/index.js b/index.js index 484a22a681..c6eae08eec 100644 --- a/index.js +++ b/index.js @@ -5,11 +5,16 @@ const createDeprecatedRules = require('./rules/utils/create-deprecated-rules'); const deprecatedRules = createDeprecatedRules({ // {ruleId: ReplacementRuleId | ReplacementRuleId[]}, if no replacement, use `{ruleId: []}` + 'no-array-instanceof': 'unicorn/no-instanceof-array', 'no-fn-reference-in-iterator': 'unicorn/no-array-callback-reference', 'no-reduce': 'unicorn/no-array-reduce', 'prefer-exponentiation-operator': 'prefer-exponentiation-operator', 'prefer-dataset': 'unicorn/prefer-node-dataset', 'prefer-flat-map': 'unicorn/prefer-array-flat-map', + 'prefer-replace-all': 'unicorn/prefer-string-replace-all', + 'prefer-starts-ends-with': 'unicorn/prefer-string-starts-ends-with', + 'prefer-text-content': 'unicorn/prefer-node-text-content', + 'prefer-trim-start-end': 'unicorn/prefer-string-trim-start-end', 'regex-shorthand': 'unicorn/better-regex' }); @@ -70,7 +75,7 @@ module.exports = { 'unicorn/prefer-add-event-listener': 'error', 'unicorn/prefer-array-find': 'error', // TODO: Enable this by default when targeting Node.js 12. - 'unicorn/prefer-flat-map': 'off', + 'unicorn/prefer-array-flat-map': 'off', 'unicorn/prefer-date-now': 'error', 'unicorn/prefer-default-parameters': 'error', 'unicorn/prefer-event-key': 'error', @@ -89,9 +94,9 @@ module.exports = { 'unicorn/prefer-set-has': 'error', 'unicorn/prefer-spread': 'error', // TODO: Enable this by default when targeting Node.js 16. - 'unicorn/prefer-starts-replace-all': 'off', - 'unicorn/prefer-starts-starts-ends-with': 'error', + 'unicorn/prefer-string-replace-all': 'off', 'unicorn/prefer-string-slice': 'error', + 'unicorn/prefer-string-starts-ends-with': 'error', 'unicorn/prefer-string-trim-start-end': 'error', 'unicorn/prefer-ternary': 'error', 'unicorn/prefer-type-error': 'error', diff --git a/readme.md b/readme.md index 5fdb1961fe..0531b5e9b0 100644 --- a/readme.md +++ b/readme.md @@ -89,8 +89,8 @@ Configure it in `package.json`. "unicorn/prefer-set-has": "error", "unicorn/prefer-spread": "error", "unicorn/prefer-string-replace-all": "off", - "unicorn/prefer-string-starts-ends-with": "error", "unicorn/prefer-string-slice": "error", + "unicorn/prefer-string-starts-ends-with": "error", "unicorn/prefer-string-trim-start-end": "error", "unicorn/prefer-ternary": "off", "unicorn/prefer-type-error": "error", diff --git a/test/snapshots/consistent-function-scoping.js.md b/test/snapshots/consistent-function-scoping.js.md deleted file mode 100644 index 33f8fd5fbd..0000000000 --- a/test/snapshots/consistent-function-scoping.js.md +++ /dev/null @@ -1,101 +0,0 @@ -# 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 deleted file mode 100644 index ef9f640673..0000000000 Binary files a/test/snapshots/consistent-function-scoping.js.snap and /dev/null differ diff --git a/test/snapshots/empty-brace-spaces.js.md b/test/snapshots/empty-brace-spaces.js.md deleted file mode 100644 index 7673525330..0000000000 --- a/test/snapshots/empty-brace-spaces.js.md +++ /dev/null @@ -1,33 +0,0 @@ -# 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 deleted file mode 100644 index 13ed1185b6..0000000000 Binary files a/test/snapshots/empty-brace-spaces.js.snap and /dev/null differ diff --git a/test/snapshots/error-message.js.md b/test/snapshots/error-message.js.md deleted file mode 100644 index 30f4e649c0..0000000000 --- a/test/snapshots/error-message.js.md +++ /dev/null @@ -1,191 +0,0 @@ -# Snapshot report for `test/error-message.js` - -The actual snapshot is saved in `error-message.js.snap`. - -Generated by [AVA](https://avajs.dev). - -## error-message - #1 - -> 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 deleted file mode 100644 index 17e4826499..0000000000 Binary files a/test/snapshots/error-message.js.snap and /dev/null differ diff --git a/test/snapshots/no-console-spaces.js.md b/test/snapshots/no-console-spaces.js.md deleted file mode 100644 index 9d50486a71..0000000000 --- a/test/snapshots/no-console-spaces.js.md +++ /dev/null @@ -1,226 +0,0 @@ -# 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 deleted file mode 100644 index 9952aedd00..0000000000 Binary files a/test/snapshots/no-console-spaces.js.snap and /dev/null differ diff --git a/test/snapshots/no-for-loop.js.md b/test/snapshots/no-for-loop.js.md deleted file mode 100644 index 13fcb9acbf..0000000000 --- a/test/snapshots/no-for-loop.js.md +++ /dev/null @@ -1,162 +0,0 @@ -# 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 deleted file mode 100644 index b3112c7711..0000000000 Binary files a/test/snapshots/no-for-loop.js.snap and /dev/null differ diff --git a/test/snapshots/no-hex-escape.js.md b/test/snapshots/no-hex-escape.js.md deleted file mode 100644 index 9a62f9d512..0000000000 --- a/test/snapshots/no-hex-escape.js.md +++ /dev/null @@ -1,21 +0,0 @@ -# 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 deleted file mode 100644 index 388c681025..0000000000 Binary files a/test/snapshots/no-hex-escape.js.snap and /dev/null differ diff --git a/test/snapshots/no-instanceof-array.js.md b/test/snapshots/no-instanceof-array.js.md deleted file mode 100644 index c48666a737..0000000000 --- a/test/snapshots/no-instanceof-array.js.md +++ /dev/null @@ -1,21 +0,0 @@ -# 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 deleted file mode 100644 index fb1a903263..0000000000 Binary files a/test/snapshots/no-instanceof-array.js.snap and /dev/null differ diff --git a/test/snapshots/no-lonely-if.js.md b/test/snapshots/no-lonely-if.js.md deleted file mode 100644 index 6c5e4cce16..0000000000 --- a/test/snapshots/no-lonely-if.js.md +++ /dev/null @@ -1,477 +0,0 @@ -# Snapshot report for `test/no-lonely-if.js` - -The actual snapshot is saved in `no-lonely-if.js.snap`. - -Generated by [AVA](https://avajs.dev). - -## no-lonely-if - #1 - -> 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 deleted file mode 100644 index b95c2cff47..0000000000 Binary files a/test/snapshots/no-lonely-if.js.snap and /dev/null differ diff --git a/test/snapshots/no-nested-ternary.js.md b/test/snapshots/no-nested-ternary.js.md deleted file mode 100644 index feb015d7b6..0000000000 --- a/test/snapshots/no-nested-ternary.js.md +++ /dev/null @@ -1,78 +0,0 @@ -# Snapshot report for `test/no-nested-ternary.js` - -The actual snapshot is saved in `no-nested-ternary.js.snap`. - -Generated by [AVA](https://avajs.dev). - -## no-nested-ternary - #1 - -> Snapshot 1 - - `␊ - Input:␊ - 1 | const foo = i > 5 ? i < 100 ? true : false : i < 100 ? true : false;␊ - ␊ - Output:␊ - 1 | const foo = i > 5 ? (i < 100 ? true : false) : (i < 100 ? true : false);␊ - ␊ - Error 1/2:␊ - > 1 | const foo = i > 5 ? i < 100 ? true : false : i < 100 ? true : false;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Nest ternary expression should be parenthesized.␊ - Error 2/2:␊ - > 1 | const foo = i > 5 ? i < 100 ? true : false : i < 100 ? true : false;␊ - | ^^^^^^^^^^^^^^^^^^^^^^ Nest ternary expression should be parenthesized.␊ - ` - -## no-nested-ternary - #2 - -> Snapshot 1 - - `␊ - Input:␊ - 1 | const foo = i > 5 ? true : (i < 100 ? true : (i < 1000 ? true : false));␊ - ␊ - Output:␊ - [Same as input]␊ - ␊ - Error 1/1:␊ - > 1 | const foo = i > 5 ? true : (i < 100 ? true : (i < 1000 ? true : false));␊ - | ^^^^^^^^^^^^^^^^^^^^^^^ Do not nest ternary expressions.␊ - ` - -## no-nested-ternary - #3 - -> Snapshot 1 - - `␊ - Input:␊ - 1 | const foo = a ?␊ - 2 | b :␊ - 3 | (␊ - 4 | c ?␊ - 5 | d :␊ - 6 | (␊ - 7 | e ?␊ - 8 | f :␊ - 9 | (g ? h : i)␊ - 10 | )␊ - 11 | )␊ - ␊ - Output:␊ - [Same as input]␊ - ␊ - Error 1/1:␊ - 1 | const foo = a ?␊ - 2 | b :␊ - 3 | (␊ - 4 | c ?␊ - 5 | d :␊ - 6 | (␊ - > 7 | e ?␊ - | ^^^␊ - > 8 | f :␊ - | ^^^^^^^^␊ - > 9 | (g ? h : i)␊ - | ^^^^^^^^^^^^^^^^^ Do not nest ternary expressions.␊ - 10 | )␊ - 11 | )␊ - ` diff --git a/test/snapshots/no-nested-ternary.js.snap b/test/snapshots/no-nested-ternary.js.snap deleted file mode 100644 index 1f01b69237..0000000000 Binary files a/test/snapshots/no-nested-ternary.js.snap and /dev/null differ diff --git a/test/snapshots/no-new-buffer.js.md b/test/snapshots/no-new-buffer.js.md deleted file mode 100644 index 46eae886a1..0000000000 --- a/test/snapshots/no-new-buffer.js.md +++ /dev/null @@ -1,37 +0,0 @@ -# Snapshot report for `test/no-new-buffer.js` - -The actual snapshot is saved in `no-new-buffer.js.snap`. - -Generated by [AVA](https://avajs.dev). - -## no-new-buffer - #1 - -> 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 deleted file mode 100644 index 39500f26ec..0000000000 Binary files a/test/snapshots/no-new-buffer.js.snap and /dev/null differ diff --git a/test/snapshots/no-object-as-default-parameter.js.md b/test/snapshots/no-object-as-default-parameter.js.md deleted file mode 100644 index 34c2b3ce07..0000000000 --- a/test/snapshots/no-object-as-default-parameter.js.md +++ /dev/null @@ -1,25 +0,0 @@ -# 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 deleted file mode 100644 index a8faa52f15..0000000000 Binary files a/test/snapshots/no-object-as-default-parameter.js.snap and /dev/null differ diff --git a/test/snapshots/no-process-exit.js.md b/test/snapshots/no-process-exit.js.md deleted file mode 100644 index 0aec16a5b2..0000000000 --- a/test/snapshots/no-process-exit.js.md +++ /dev/null @@ -1,15 +0,0 @@ -# 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 deleted file mode 100644 index 5fcaacf532..0000000000 Binary files a/test/snapshots/no-process-exit.js.snap and /dev/null differ diff --git a/test/snapshots/no-unreadable-array-destructuring.js.md b/test/snapshots/no-unreadable-array-destructuring.js.md deleted file mode 100644 index 4df427f049..0000000000 --- a/test/snapshots/no-unreadable-array-destructuring.js.md +++ /dev/null @@ -1,125 +0,0 @@ -# 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 deleted file mode 100644 index 0aef7d7ed4..0000000000 Binary files a/test/snapshots/no-unreadable-array-destructuring.js.snap and /dev/null differ diff --git a/test/snapshots/no-unsafe-regex.js.md b/test/snapshots/no-unsafe-regex.js.md deleted file mode 100644 index df00483a17..0000000000 --- a/test/snapshots/no-unsafe-regex.js.md +++ /dev/null @@ -1,15 +0,0 @@ -# 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 deleted file mode 100644 index b288cb42b6..0000000000 Binary files a/test/snapshots/no-unsafe-regex.js.snap and /dev/null differ diff --git a/test/snapshots/no-unused-properties.js.md b/test/snapshots/no-unused-properties.js.md deleted file mode 100644 index 91244aab09..0000000000 --- a/test/snapshots/no-unused-properties.js.md +++ /dev/null @@ -1,21 +0,0 @@ -# Snapshot report for `test/no-unused-properties.js` - -The actual snapshot is saved in `no-unused-properties.js.snap`. - -Generated by [AVA](https://avajs.dev). - -## no-unused-properties - #1 - -> 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 deleted file mode 100644 index b8bd496e7c..0000000000 Binary files a/test/snapshots/no-unused-properties.js.snap and /dev/null differ diff --git a/test/snapshots/no-useless-undefined.js.md b/test/snapshots/no-useless-undefined.js.md deleted file mode 100644 index a287c9ee5d..0000000000 --- a/test/snapshots/no-useless-undefined.js.md +++ /dev/null @@ -1,89 +0,0 @@ -# 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 deleted file mode 100644 index 6cffbb7350..0000000000 Binary files a/test/snapshots/no-useless-undefined.js.snap and /dev/null differ diff --git a/test/snapshots/no-zero-fractions.js.md b/test/snapshots/no-zero-fractions.js.md deleted file mode 100644 index 7573b6b3b3..0000000000 --- a/test/snapshots/no-zero-fractions.js.md +++ /dev/null @@ -1,37 +0,0 @@ -# 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 deleted file mode 100644 index be4a950d34..0000000000 Binary files a/test/snapshots/no-zero-fractions.js.snap and /dev/null differ diff --git a/test/snapshots/prefer-flat-map.js.md b/test/snapshots/prefer-array-flat-map.js.md similarity index 86% rename from test/snapshots/prefer-flat-map.js.md rename to test/snapshots/prefer-array-flat-map.js.md index e2b3d41f78..a0c1a2943d 100644 --- a/test/snapshots/prefer-flat-map.js.md +++ b/test/snapshots/prefer-array-flat-map.js.md @@ -1,10 +1,10 @@ -# Snapshot report for `test/prefer-flat-map.js` +# Snapshot report for `test/prefer-array-flat-map.js` -The actual snapshot is saved in `prefer-flat-map.js.snap`. +The actual snapshot is saved in `prefer-array-flat-map.js.snap`. Generated by [AVA](https://avajs.dev). -## prefer-flat-map - #1 +## prefer-array-flat-map - #1 > Snapshot 1 @@ -20,7 +20,7 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `.flatMap(…)` over `.map(…).flat()`.␊ ` -## prefer-flat-map - #2 +## prefer-array-flat-map - #2 > Snapshot 1 @@ -36,7 +36,7 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `.flatMap(…)` over `.map(…).flat()`.␊ ` -## prefer-flat-map - #3 +## prefer-array-flat-map - #3 > Snapshot 1 @@ -52,7 +52,7 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `.flatMap(…)` over `.map(…).flat()`.␊ ` -## prefer-flat-map - #4 +## prefer-array-flat-map - #4 > Snapshot 1 diff --git a/test/snapshots/prefer-array-flat-map.js.snap b/test/snapshots/prefer-array-flat-map.js.snap new file mode 100644 index 0000000000..a497327bc4 Binary files /dev/null and b/test/snapshots/prefer-array-flat-map.js.snap differ diff --git a/test/snapshots/prefer-dataset.js.snap b/test/snapshots/prefer-dataset.js.snap deleted file mode 100644 index 50527dd7db..0000000000 Binary files a/test/snapshots/prefer-dataset.js.snap and /dev/null differ diff --git a/test/snapshots/prefer-flat-map.js.snap b/test/snapshots/prefer-flat-map.js.snap deleted file mode 100644 index dced5a00c9..0000000000 Binary files a/test/snapshots/prefer-flat-map.js.snap and /dev/null differ diff --git a/test/snapshots/prefer-dataset.js.md b/test/snapshots/prefer-node-dataset.js.md similarity index 80% rename from test/snapshots/prefer-dataset.js.md rename to test/snapshots/prefer-node-dataset.js.md index 2726f00cc3..ef9601c86e 100644 --- a/test/snapshots/prefer-dataset.js.md +++ b/test/snapshots/prefer-node-dataset.js.md @@ -1,10 +1,10 @@ -# Snapshot report for `test/prefer-dataset.js` +# Snapshot report for `test/prefer-node-dataset.js` -The actual snapshot is saved in `prefer-dataset.js.snap`. +The actual snapshot is saved in `prefer-node-dataset.js.snap`. Generated by [AVA](https://avajs.dev). -## prefer-dataset - #1 +## prefer-node-dataset - #1 > Snapshot 1 diff --git a/test/snapshots/prefer-node-dataset.js.snap b/test/snapshots/prefer-node-dataset.js.snap new file mode 100644 index 0000000000..daa0e69d16 Binary files /dev/null and b/test/snapshots/prefer-node-dataset.js.snap differ diff --git a/test/snapshots/prefer-replace-all.js.snap b/test/snapshots/prefer-replace-all.js.snap deleted file mode 100644 index f393c9b7b7..0000000000 Binary files a/test/snapshots/prefer-replace-all.js.snap and /dev/null differ diff --git a/test/snapshots/prefer-replace-all.js.md b/test/snapshots/prefer-string-replace-all.js.md similarity index 76% rename from test/snapshots/prefer-replace-all.js.md rename to test/snapshots/prefer-string-replace-all.js.md index efa4dadcfd..fa31a13043 100644 --- a/test/snapshots/prefer-replace-all.js.md +++ b/test/snapshots/prefer-string-replace-all.js.md @@ -1,10 +1,10 @@ -# Snapshot report for `test/prefer-replace-all.js` +# Snapshot report for `test/prefer-string-replace-all.js` -The actual snapshot is saved in `prefer-replace-all.js.snap`. +The actual snapshot is saved in `prefer-string-replace-all.js.snap`. Generated by [AVA](https://avajs.dev). -## prefer-replace-all - #1 +## prefer-string-replace-all - #1 > Snapshot 1 @@ -20,7 +20,7 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^^^^^^^^^^^^ Prefer `String#replaceAll()` over `String#replace()`.␊ ` -## prefer-replace-all - #2 +## prefer-string-replace-all - #2 > Snapshot 1 diff --git a/test/snapshots/prefer-string-replace-all.js.snap b/test/snapshots/prefer-string-replace-all.js.snap new file mode 100644 index 0000000000..83c7de5e06 Binary files /dev/null and b/test/snapshots/prefer-string-replace-all.js.snap differ diff --git a/test/snapshots/prefer-trim-start-end.js.md b/test/snapshots/prefer-string-trim-start-end.js.md similarity index 80% rename from test/snapshots/prefer-trim-start-end.js.md rename to test/snapshots/prefer-string-trim-start-end.js.md index e2feba25e8..d85e177a90 100644 --- a/test/snapshots/prefer-trim-start-end.js.md +++ b/test/snapshots/prefer-string-trim-start-end.js.md @@ -1,10 +1,10 @@ -# Snapshot report for `test/prefer-trim-start-end.js` +# Snapshot report for `test/prefer-string-trim-start-end.js` -The actual snapshot is saved in `prefer-trim-start-end.js.snap`. +The actual snapshot is saved in `prefer-string-trim-start-end.js.snap`. Generated by [AVA](https://avajs.dev). -## prefer-trim-start-end - #1 +## prefer-string-trim-start-end - #1 > Snapshot 1 @@ -20,7 +20,7 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^ Prefer `String#trimStart()` over `String#trimLeft()`.␊ ` -## prefer-trim-start-end - #2 +## prefer-string-trim-start-end - #2 > Snapshot 1 diff --git a/test/snapshots/prefer-string-trim-start-end.js.snap b/test/snapshots/prefer-string-trim-start-end.js.snap new file mode 100644 index 0000000000..be5d075390 Binary files /dev/null and b/test/snapshots/prefer-string-trim-start-end.js.snap differ diff --git a/test/snapshots/prefer-trim-start-end.js.snap b/test/snapshots/prefer-trim-start-end.js.snap deleted file mode 100644 index 4304e6d7f0..0000000000 Binary files a/test/snapshots/prefer-trim-start-end.js.snap and /dev/null differ