diff --git a/docs/rules/no-array-for-each.md b/docs/rules/no-array-for-each.md index 967d3f318d..36f56eaac4 100644 --- a/docs/rules/no-array-for-each.md +++ b/docs/rules/no-array-for-each.md @@ -1,4 +1,4 @@ -# Prefer `for…of` over `Array#forEach(…)` +# Prefer `for…of` over the `forEach` method @@ -7,7 +7,7 @@ 🔧💡 *This rule is [auto-fixable](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) and provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).* -Benefits of [`for…of` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) over [`Array#forEach(…)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) can include: +Benefits of [`for…of` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) over the `forEach` method can include: - Faster - Better readability diff --git a/readme.md b/readme.md index c2f1f18f76..16689c14fa 100644 --- a/readme.md +++ b/readme.md @@ -69,7 +69,7 @@ Each rule has emojis denoting: | [new-for-builtins](docs/rules/new-for-builtins.md) | Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`. | ✅ | 🔧 | | | [no-abusive-eslint-disable](docs/rules/no-abusive-eslint-disable.md) | Enforce specifying rules to disable in `eslint-disable` comments. | ✅ | | | | [no-array-callback-reference](docs/rules/no-array-callback-reference.md) | Prevent passing a function reference directly to iterator methods. | ✅ | | 💡 | -| [no-array-for-each](docs/rules/no-array-for-each.md) | Prefer `for…of` over `Array#forEach(…)`. | ✅ | 🔧 | 💡 | +| [no-array-for-each](docs/rules/no-array-for-each.md) | Prefer `for…of` over the `forEach` method. | ✅ | 🔧 | 💡 | | [no-array-method-this-argument](docs/rules/no-array-method-this-argument.md) | Disallow using the `this` argument in array methods. | ✅ | 🔧 | 💡 | | [no-array-push-push](docs/rules/no-array-push-push.md) | Enforce combining multiple `Array#push()` into one call. | ✅ | 🔧 | 💡 | | [no-array-reduce](docs/rules/no-array-reduce.md) | Disallow `Array#reduce()` and `Array#reduceRight()`. | ✅ | | | diff --git a/rules/no-array-for-each.js b/rules/no-array-for-each.js index c883662869..6aabcd084b 100644 --- a/rules/no-array-for-each.js +++ b/rules/no-array-for-each.js @@ -22,11 +22,11 @@ const {fixSpaceAroundKeyword, removeParentheses} = require('./fix/index.js'); const MESSAGE_ID_ERROR = 'no-array-for-each/error'; const MESSAGE_ID_SUGGESTION = 'no-array-for-each/suggestion'; const messages = { - [MESSAGE_ID_ERROR]: 'Use `for…of` instead of `Array#forEach(…)`.', + [MESSAGE_ID_ERROR]: 'Use `for…of` instead of `.forEach(…)`.', [MESSAGE_ID_SUGGESTION]: 'Switch to `for…of`.', }; -const arrayForEachCallSelector = methodCallSelector({ +const forEachMethodCallSelector = methodCallSelector({ method: 'forEach', includeOptionalCall: true, includeOptionalMember: true, @@ -80,34 +80,34 @@ function getFixFunction(callExpression, functionInfo, context) { const sourceCode = context.getSourceCode(); const [callback] = callExpression.arguments; const parameters = callback.params; - const array = callExpression.callee.object; + const iterableObject = callExpression.callee.object; const {returnStatements} = functionInfo.get(callback); - const isOptionalArray = callExpression.callee.optional; + const isOptionalObject = callExpression.callee.optional; const expressionStatement = stripChainExpression(callExpression).parent; - const arrayText = sourceCode.getText(array); + const objectText = sourceCode.getText(iterableObject); const getForOfLoopHeadText = () => { const [elementText, indexText] = parameters.map(parameter => sourceCode.getText(parameter)); - const useEntries = parameters.length === 2; + const shouldUseEntries = parameters.length === 2; let text = 'for ('; text += isFunctionParameterVariableReassigned(callback, context) ? 'let' : 'const'; text += ' '; - text += useEntries ? `[${indexText}, ${elementText}]` : elementText; + text += shouldUseEntries ? `[${indexText}, ${elementText}]` : elementText; text += ' of '; - const shouldAddParenthesesToArray - = isParenthesized(array, sourceCode) + const shouldAddParenthesesToObject + = isParenthesized(iterableObject, sourceCode) || ( // `1?.forEach()` -> `(1).entries()` - isOptionalArray - && useEntries - && shouldAddParenthesesToMemberExpressionObject(array, sourceCode) + isOptionalObject + && shouldUseEntries + && shouldAddParenthesesToMemberExpressionObject(iterableObject, sourceCode) ); - text += shouldAddParenthesesToArray ? `(${arrayText})` : arrayText; + text += shouldAddParenthesesToObject ? `(${objectText})` : objectText; - if (useEntries) { + if (shouldUseEntries) { text += '.entries()'; } @@ -257,8 +257,8 @@ function getFixFunction(callExpression, functionInfo, context) { yield * fixSpaceAroundKeyword(fixer, callExpression.parent, sourceCode); - if (isOptionalArray) { - yield fixer.insertTextBefore(callExpression, `if (${arrayText}) `); + if (isOptionalObject) { + yield fixer.insertTextBefore(callExpression, `if (${objectText}) `); } // Prevent possible variable conflicts @@ -276,7 +276,7 @@ const isChildScope = (child, parent) => { return false; }; -function isFunctionParametersSafeToFix(callbackFunction, {context, scope, array, allIdentifiers}) { +function isFunctionParametersSafeToFix(callbackFunction, {context, scope, callExpression, allIdentifiers}) { const variables = context.getDeclaredVariables(callbackFunction); for (const variable of variables) { @@ -290,13 +290,13 @@ function isFunctionParametersSafeToFix(callbackFunction, {context, scope, array, } const variableName = definition.name.name; - const [arrayStart, arrayEnd] = array.range; + const [callExpressionStart, callExpressionEnd] = callExpression.range; for (const identifier of allIdentifiers) { const {name, range: [start, end]} = identifier; if ( name !== variableName - || start < arrayStart - || end > arrayEnd + || start < callExpressionStart + || end > callExpressionEnd ) { continue; } @@ -352,7 +352,7 @@ function isFixable(callExpression, {scope, functionInfo, allIdentifiers, context if ( !(parameters.length === 1 || parameters.length === 2) || parameters.some(({type, typeAnnotation}) => type === 'RestElement' || typeAnnotation) - || !isFunctionParametersSafeToFix(callback, {scope, array: callExpression, allIdentifiers, context}) + || !isFunctionParametersSafeToFix(callback, {scope, callExpression, allIdentifiers, context}) ) { return false; } @@ -405,7 +405,7 @@ const create = context => { const {returnStatements} = functionInfo.get(currentFunction); returnStatements.push(node); }, - [arrayForEachCallSelector](node) { + [forEachMethodCallSelector](node) { if (isNodeMatches(node.callee.object, ignoredObjects)) { return; } @@ -417,11 +417,10 @@ const create = context => { }, * 'Program:exit'() { for (const {node, scope} of callExpressions) { - // TODO: Rename this to iteratable - const array = node.callee; + const iterable = node.callee; const problem = { - node: array.property, + node: iterable.property, messageId: MESSAGE_ID_ERROR, }; @@ -430,7 +429,7 @@ const create = context => { continue; } - const shouldUseSuggestion = array.optional && hasSideEffect(array, sourceCode); + const shouldUseSuggestion = iterable.optional && hasSideEffect(iterable, sourceCode); const fix = getFixFunction(node, functionInfo, context); if (shouldUseSuggestion) { @@ -456,7 +455,7 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Prefer `for…of` over `Array#forEach(…)`.', + description: 'Prefer `for…of` over the `forEach` method.', }, fixable: 'code', hasSuggestions: true, diff --git a/test/snapshots/no-array-for-each.mjs.md b/test/snapshots/no-array-for-each.mjs.md index f7c206ec06..44728824c5 100644 --- a/test/snapshots/no-array-for-each.mjs.md +++ b/test/snapshots/no-array-for-each.mjs.md @@ -11,7 +11,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach?.(element => bar(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #2 @@ -27,7 +27,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (( foo.forEach(element => bar(element)) ))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #3 @@ -43,7 +43,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (( foo?.forEach(element => bar(element)) ))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #4 @@ -53,7 +53,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => bar(element), thisArgument)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #5 @@ -63,7 +63,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => bar(element), thisArgument)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #6 @@ -73,7 +73,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach()␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #7 @@ -83,7 +83,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach()␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #8 @@ -93,7 +93,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const baz = foo.forEach(element => bar(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #9 @@ -103,7 +103,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | const baz = foo?.forEach(element => bar(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #10 @@ -113,7 +113,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #11 @@ -123,7 +123,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #12 @@ -133,7 +133,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(async function(element) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #13 @@ -143,7 +143,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(async function(element) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #14 @@ -153,7 +153,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function * (element) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #15 @@ -163,7 +163,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function * (element) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #16 @@ -173,7 +173,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(() => bar())␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #17 @@ -183,7 +183,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(() => bar())␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #18 @@ -193,7 +193,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index, array) => bar())␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #19 @@ -203,7 +203,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index, array) => bar())␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #20 @@ -213,7 +213,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | property.forEach(({property}) => bar(property))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #21 @@ -223,7 +223,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | property?.forEach(({property}) => bar(property))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #22 @@ -233,7 +233,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | () => foo.forEach()␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #23 @@ -243,7 +243,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | () => foo?.forEach()␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #24 @@ -257,7 +257,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | do {␊ 3 | return␊ 4 | } while (element)␊ @@ -275,7 +275,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | do {␊ 3 | return␊ 4 | } while (element)␊ @@ -293,7 +293,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | while (element) {␊ 3 | return;␊ 4 | }␊ @@ -311,7 +311,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | while (element) {␊ 3 | return;␊ 4 | }␊ @@ -329,7 +329,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | for (let i = 0; i < 2; i++) {␊ 3 | return;␊ 4 | }␊ @@ -347,7 +347,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | for (let i = 0; i < 2; i++) {␊ 3 | return;␊ 4 | }␊ @@ -365,7 +365,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | for (let i in element) {␊ 3 | return;␊ 4 | }␊ @@ -383,7 +383,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | for (let i in element) {␊ 3 | return;␊ 4 | }␊ @@ -401,7 +401,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | for (let i of element) {␊ 3 | return;␊ 4 | }␊ @@ -419,7 +419,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | for (let i of element) {␊ 3 | return;␊ 4 | }␊ @@ -453,7 +453,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | switch (element) {␊ 3 | case 1:␊ 4 | break;␊ @@ -490,7 +490,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | switch (element) {␊ 3 | case 1:␊ 4 | break;␊ @@ -507,7 +507,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #37 @@ -517,7 +517,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #38 @@ -529,7 +529,7 @@ Generated by [AVA](https://avajs.dev). `␊ 1 | const foo = [];␊ > 2 | foo.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #39 @@ -541,7 +541,7 @@ Generated by [AVA](https://avajs.dev). `␊ 1 | const foo = [];␊ > 2 | foo?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #40 @@ -556,7 +556,7 @@ Generated by [AVA](https://avajs.dev). 1 | const foo = [];␊ 2 | function unicorn() {␊ > 3 | foo.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 4 | }␊ ` @@ -572,7 +572,7 @@ Generated by [AVA](https://avajs.dev). 1 | const foo = [];␊ 2 | function unicorn() {␊ > 3 | foo?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 4 | }␊ ` @@ -583,7 +583,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | index.forEach((a, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #43 @@ -593,7 +593,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | index?.forEach((a, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #44 @@ -605,7 +605,7 @@ Generated by [AVA](https://avajs.dev). `␊ 1 | const index = [];␊ > 2 | index.forEach((a, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #45 @@ -617,7 +617,7 @@ Generated by [AVA](https://avajs.dev). `␊ 1 | const index = [];␊ > 2 | index?.forEach((a, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #46 @@ -632,7 +632,7 @@ Generated by [AVA](https://avajs.dev). 1 | const index = [];␊ 2 | function unicorn() {␊ > 3 | index.forEach((a, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 4 | }␊ ` @@ -648,7 +648,7 @@ Generated by [AVA](https://avajs.dev). 1 | const index = [];␊ 2 | function unicorn() {␊ > 3 | index?.forEach((a, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 4 | }␊ ` @@ -659,7 +659,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a[foo].forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #49 @@ -669,7 +669,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a[foo]?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #50 @@ -681,7 +681,7 @@ Generated by [AVA](https://avajs.dev). `␊ 1 | const foo = 1;␊ > 2 | a[foo].forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #51 @@ -693,7 +693,7 @@ Generated by [AVA](https://avajs.dev). `␊ 1 | const foo = 1;␊ > 2 | a[foo]?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #52 @@ -708,7 +708,7 @@ Generated by [AVA](https://avajs.dev). 1 | const foo = 1;␊ 2 | function unicorn() {␊ > 3 | a[foo].forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 4 | }␊ ` @@ -724,7 +724,7 @@ Generated by [AVA](https://avajs.dev). 1 | const foo = 1;␊ 2 | function unicorn() {␊ > 3 | a[foo]?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 4 | }␊ ` @@ -735,7 +735,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a[index].forEach((b, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #55 @@ -745,7 +745,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a[index]?.forEach((b, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #56 @@ -761,7 +761,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a((foo) => foo).forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #57 @@ -771,7 +771,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a((foo) => foo)?.forEach(foo => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ␊ --------------------------------------------------------------------------------␊ Suggestion 1/1: Switch to \`for…of\`.␊ @@ -791,7 +791,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a((foo, index) => foo + index).forEach((foo, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #59 @@ -801,7 +801,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a((foo, index) => foo + index)?.forEach((foo, index) => bar());␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ␊ --------------------------------------------------------------------------------␊ Suggestion 1/1: Switch to \`for…of\`.␊ @@ -827,7 +827,7 @@ Generated by [AVA](https://avajs.dev). 1 | const foo = [];␊ 2 | const index = 1;␊ > 3 | a.forEach((foo, index) => foo[index]);␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #61 @@ -849,7 +849,7 @@ Generated by [AVA](https://avajs.dev). 1 | const foo = [];␊ 2 | const index = 1;␊ > 3 | a?.forEach((foo, index) => foo[index]);␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #62 @@ -861,7 +861,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function a(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(a)␊ 3 | })␊ ` @@ -875,7 +875,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function a(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(a)␊ 3 | })␊ ` @@ -891,7 +891,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function a(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b() {␊ 3 | bar(a)␊ 4 | }␊ @@ -909,7 +909,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function a(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b() {␊ 3 | bar(a)␊ 4 | }␊ @@ -937,7 +937,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function a(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b(a) {␊ 3 | bar(a)␊ 4 | }␊ @@ -965,7 +965,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function a(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b(a) {␊ 3 | bar(a)␊ 4 | }␊ @@ -981,7 +981,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(this)␊ 3 | })␊ ` @@ -995,7 +995,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(this)␊ 3 | })␊ ` @@ -1021,7 +1021,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b() {␊ 3 | bar(this)␊ 4 | }␊ @@ -1049,7 +1049,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b() {␊ 3 | bar(this)␊ 4 | }␊ @@ -1077,7 +1077,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const x = b => {␊ 3 | bar(this)␊ 4 | }␊ @@ -1105,7 +1105,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const x = b => {␊ 3 | bar(this)␊ 4 | }␊ @@ -1129,7 +1129,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(this)␊ 3 | })␊ ` @@ -1151,7 +1151,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(this)␊ 3 | })␊ ` @@ -1165,7 +1165,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(arguments)␊ 3 | })␊ ` @@ -1179,7 +1179,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(arguments)␊ 3 | })␊ ` @@ -1205,7 +1205,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b() {␊ 3 | bar(arguments)␊ 4 | }␊ @@ -1233,7 +1233,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | function b() {␊ 3 | bar(arguments)␊ 4 | }␊ @@ -1261,7 +1261,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const b = () => {␊ 3 | bar(arguments)␊ 4 | }␊ @@ -1289,7 +1289,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const b = () => {␊ 3 | bar(arguments)␊ 4 | }␊ @@ -1313,7 +1313,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(arguments)␊ 3 | })␊ ` @@ -1335,7 +1335,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(arguments)␊ 3 | })␊ ` @@ -1347,7 +1347,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a = foo?.bar.forEach((element) => bar(element));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #85 @@ -1357,7 +1357,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | a = foo?.bar?.forEach((element) => bar(element));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #86 @@ -1377,7 +1377,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function (element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ ` @@ -1399,7 +1399,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function (element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ ` @@ -1421,7 +1421,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function withName(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ ` @@ -1443,7 +1443,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function withName(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ ` @@ -1465,7 +1465,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ ` @@ -1487,7 +1487,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ ` @@ -1505,7 +1505,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => bar(element));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #93 @@ -1521,7 +1521,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => bar(element));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #94 @@ -1541,7 +1541,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function (element, index) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element, index);␊ 3 | });␊ ` @@ -1563,7 +1563,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function (element, index) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element, index);␊ 3 | });␊ ` @@ -1585,7 +1585,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function withName(element, index) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element, index);␊ 3 | });␊ ` @@ -1607,7 +1607,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function withName(element, index) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element, index);␊ 3 | });␊ ` @@ -1629,7 +1629,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element, index);␊ 3 | });␊ ` @@ -1651,7 +1651,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element, index);␊ 3 | });␊ ` @@ -1669,7 +1669,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index) => bar(element, index));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #101 @@ -1685,7 +1685,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index) => bar(element, index));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #102 @@ -1701,7 +1701,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.bar.forEach((element) => bar(element));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #103 @@ -1717,7 +1717,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.bar?.forEach((element) => bar(element));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #104 @@ -1733,7 +1733,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.bar.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #105 @@ -1749,7 +1749,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.bar?.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #106 @@ -1765,7 +1765,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.bar().forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #107 @@ -1775,7 +1775,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.bar()?.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ␊ --------------------------------------------------------------------------------␊ Suggestion 1/1: Switch to \`for…of\`.␊ @@ -1795,7 +1795,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (a ? b : c).forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #109 @@ -1811,7 +1811,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (a ? b : c)?.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #110 @@ -1827,7 +1827,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (a ? b : c()).forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #111 @@ -1837,7 +1837,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (a ? b : c())?.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ␊ --------------------------------------------------------------------------------␊ Suggestion 1/1: Switch to \`for…of\`.␊ @@ -1857,7 +1857,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (foo || bar).forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #113 @@ -1873,7 +1873,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (foo || bar)?.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #114 @@ -1889,7 +1889,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (foo || bar()).forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #115 @@ -1899,7 +1899,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (foo || bar())?.forEach((element) => log(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ␊ --------------------------------------------------------------------------------␊ Suggestion 1/1: Switch to \`for…of\`.␊ @@ -1919,7 +1919,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (foo).forEach((element, index) => bar(element, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #117 @@ -1935,7 +1935,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (foo)?.forEach((element, index) => bar(element, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #118 @@ -1951,7 +1951,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (0, foo).forEach((element, index) => bar(element, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #119 @@ -1967,7 +1967,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (0, foo)?.forEach((element, index) => bar(element, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #120 @@ -1987,7 +1987,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function (element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | },);␊ ` @@ -2009,7 +2009,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function (element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | },);␊ ` @@ -2031,7 +2031,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function withName(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | },);␊ ` @@ -2053,7 +2053,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function withName(element) {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | },);␊ ` @@ -2075,7 +2075,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | },);␊ ` @@ -2097,7 +2097,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | },);␊ ` @@ -2115,7 +2115,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => bar(element),);␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #127 @@ -2131,7 +2131,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => bar(element),);␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #128 @@ -2149,7 +2149,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => bar(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | ;[foo].pop();␊ ` @@ -2168,7 +2168,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => bar(element))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | ;[foo].pop();␊ ` @@ -2199,7 +2199,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ 4 | function noneRelatedFunction() {␊ @@ -2236,7 +2236,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | bar(element);␊ 3 | });␊ 4 | function noneRelatedFunction() {␊ @@ -2259,7 +2259,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => ({}))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #133 @@ -2275,7 +2275,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => ({}))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #134 @@ -2291,7 +2291,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((((((element => bar(element)))))));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #135 @@ -2307,7 +2307,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((((((element => bar(element)))))));␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #136 @@ -2403,7 +2403,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | if (1) {␊ 3 | return;␊ 4 | }␊ @@ -2539,7 +2539,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | if (1) {␊ 3 | return;␊ 4 | }␊ @@ -2595,7 +2595,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | node.children.index.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #139 @@ -2611,7 +2611,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | node.children.index?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #140 @@ -2627,7 +2627,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (node?.children?.index).forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #141 @@ -2643,7 +2643,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (node?.children?.index)?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #142 @@ -2653,7 +2653,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | node[children].index.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #143 @@ -2663,7 +2663,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | node[children].index?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #144 @@ -2673,7 +2673,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (node.children?.[index]).forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #145 @@ -2683,7 +2683,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | (node.children?.[index])?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #146 @@ -2699,7 +2699,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{children: 1, index: 1}].forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #147 @@ -2715,7 +2715,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{children: 1, index: 1}]?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #148 @@ -2725,7 +2725,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{[children]: 1, index: 1}].forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #149 @@ -2735,7 +2735,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{[children]: 1, index: 1}]?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #150 @@ -2745,7 +2745,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{[children]: 1, [index]: 1}].forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #151 @@ -2755,7 +2755,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{[children]: 1, [index]: 1}]?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #152 @@ -2765,7 +2765,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{children, index: 1}].forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #153 @@ -2775,7 +2775,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{children, index: 1}]?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #154 @@ -2785,7 +2785,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{children: 1, index}].forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #155 @@ -2795,7 +2795,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [{children: 1, index}]?.forEach((children, index) => process(children, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #156 @@ -2811,7 +2811,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [function name() {}].forEach((name, index) => process(name, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #157 @@ -2827,7 +2827,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [function name() {}]?.forEach((name, index) => process(name, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #158 @@ -2855,7 +2855,7 @@ Generated by [AVA](https://avajs.dev). 3 | function index() {}␊ 4 | }␊ > 5 | ].forEach((name, index) => process(name, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #159 @@ -2887,7 +2887,7 @@ Generated by [AVA](https://avajs.dev). 3 | function index() {}␊ 4 | }␊ > 5 | ]?.forEach((name, index) => process(name, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #160 @@ -2915,7 +2915,7 @@ Generated by [AVA](https://avajs.dev). 3 | class index {}␊ 4 | }␊ > 5 | ].forEach((name, index) => process(name, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #161 @@ -2947,7 +2947,7 @@ Generated by [AVA](https://avajs.dev). 3 | class index {}␊ 4 | }␊ > 5 | ]?.forEach((name, index) => process(name, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #162 @@ -2963,7 +2963,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [class Foo{}].forEach((Foo, index) => process(Foo, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #163 @@ -2979,7 +2979,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [class Foo{}]?.forEach((Foo, index) => process(Foo, index))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #164 @@ -2995,7 +2995,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [class Foo{}].forEach((X, Foo) => process(X, Foo))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #165 @@ -3011,7 +3011,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | [class Foo{}]?.forEach((X, Foo) => process(X, Foo))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #166 @@ -3039,7 +3039,7 @@ Generated by [AVA](https://avajs.dev). 3 | bar() {}␊ 4 | }␊ > 5 | ].forEach((Foo, bar) => process(Foo, bar))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #167 @@ -3071,7 +3071,7 @@ Generated by [AVA](https://avajs.dev). 3 | bar() {}␊ 4 | }␊ > 5 | ]?.forEach((Foo, bar) => process(Foo, bar))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #168 @@ -3081,7 +3081,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.React.Children.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #169 @@ -3091,7 +3091,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.React.Children?.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #170 @@ -3101,7 +3101,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | NotReact.Children.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #171 @@ -3111,7 +3111,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | NotReact.Children?.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #172 @@ -3121,7 +3121,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | React.NotChildren.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #173 @@ -3131,7 +3131,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | React.NotChildren?.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #174 @@ -3141,7 +3141,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | React?.Children.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #175 @@ -3151,7 +3151,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | React?.Children?.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #176 @@ -3161,7 +3161,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | NotChildren.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #177 @@ -3171,7 +3171,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | NotChildren?.forEach(bar)␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #178 @@ -3191,7 +3191,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | element ++;␊ 3 | })␊ ` @@ -3213,7 +3213,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | element ++;␊ 3 | })␊ ` @@ -3235,7 +3235,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const a = -- element;␊ 3 | })␊ ` @@ -3257,7 +3257,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(element => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const a = -- element;␊ 3 | })␊ ` @@ -3281,7 +3281,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | index ++;␊ 3 | element = 2␊ 4 | });␊ @@ -3306,7 +3306,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | index ++;␊ 3 | element = 2␊ 4 | });␊ @@ -3329,7 +3329,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | element >>>= 2;␊ 3 | });␊ ` @@ -3351,7 +3351,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | element >>>= 2;␊ 3 | });␊ ` @@ -3373,7 +3373,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const a = element = 1;␊ 3 | });␊ ` @@ -3395,7 +3395,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | const a = element = 1;␊ 3 | });␊ ` @@ -3419,7 +3419,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | let a;␊ 3 | a >>>= element;␊ 4 | });␊ @@ -3444,7 +3444,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | let a;␊ 3 | a >>>= element;␊ 4 | });␊ @@ -3463,7 +3463,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(({property}) => {bar(property)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #191 @@ -3479,7 +3479,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(({property}) => {bar(property)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #192 @@ -3495,7 +3495,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(({foo: {foo: [property]}}) => {bar(property, index)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #193 @@ -3511,7 +3511,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(({foo: {foo: [property]}}) => {bar(property, index)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #194 @@ -3527,7 +3527,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element, {bar: {bar: [index]}}) => {bar(element, index)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #195 @@ -3543,7 +3543,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element, {bar: {bar: [index]}}) => {bar(element, index)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #196 @@ -3559,7 +3559,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #197 @@ -3575,7 +3575,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #198 @@ -3591,7 +3591,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(({}) => {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #199 @@ -3607,7 +3607,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(({}) => {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #200 @@ -3623,7 +3623,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function foo({a, b, c, d}) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #201 @@ -3639,7 +3639,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function foo({a, b, c, d}) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #202 @@ -3649,7 +3649,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(function foo({a, b, c, d, foo}) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #203 @@ -3659,7 +3659,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(function foo({a, b, c, d, foo}) {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #204 @@ -3675,7 +3675,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(({foo: property}) => {bar(property)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #205 @@ -3691,7 +3691,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(({foo: property}) => {bar(property)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #206 @@ -3707,7 +3707,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(({[foo]: property}) => {bar(property)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #207 @@ -3723,7 +3723,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(({[foo]: property}) => {bar(property)})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #208 @@ -3743,7 +3743,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(({element}, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | element &&= 2;␊ 3 | });␊ ` @@ -3765,7 +3765,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(({element}, index) => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | element &&= 2;␊ 3 | });␊ ` @@ -3787,7 +3787,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(_ => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | if (true) return {};␊ 3 | })␊ ` @@ -3809,7 +3809,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(_ => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | if (true) return {};␊ 3 | })␊ ` @@ -3833,7 +3833,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo.forEach(_ => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | if (true);␊ 3 | else return {};␊ 4 | })␊ @@ -3858,7 +3858,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | foo?.forEach(_ => {␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ 2 | if (true);␊ 3 | else return {};␊ 4 | })␊ @@ -3877,7 +3877,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | if (true) {} else[foo].forEach((element) => {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #215 @@ -3893,7 +3893,7 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | if (true) {} else[foo]?.forEach((element) => {})␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` ## Invalid #216 @@ -3909,5 +3909,5 @@ Generated by [AVA](https://avajs.dev). `␊ > 1 | 1?.forEach((a, b) => call(a, b))␊ - | ^^^^^^^ Use \`for…of\` instead of \`Array#forEach(…)\`.␊ + | ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊ ` diff --git a/test/snapshots/no-array-for-each.mjs.snap b/test/snapshots/no-array-for-each.mjs.snap index f953853662..91e2006dc0 100644 Binary files a/test/snapshots/no-array-for-each.mjs.snap and b/test/snapshots/no-array-for-each.mjs.snap differ