diff --git a/rules/no-array-method-this-argument.js b/rules/no-array-method-this-argument.js index e865d8109a..58afc6d0da 100644 --- a/rules/no-array-method-this-argument.js +++ b/rules/no-array-method-this-argument.js @@ -7,11 +7,13 @@ const {isNodeMatches} = require('./utils/is-node-matches.js'); const {isNodeValueNotFunction} = require('./utils/index.js'); const {isMethodCall} = require('./ast/index.js'); -const ERROR = 'error'; +const ERROR_PROTOTYPE_METHOD = 'error-prototype-method'; +const ERROR_STATIC_METHOD = 'error-static-method'; const SUGGESTION_BIND = 'suggestion-bind'; const SUGGESTION_REMOVE = 'suggestion-remove'; const messages = { - [ERROR]: 'Do not use the `this` argument in `Array#{{method}}()`.', + [ERROR_PROTOTYPE_METHOD]: 'Do not use the `this` argument in `Array#{{method}}()`.', + [ERROR_STATIC_METHOD]: 'Do not use the `this` argument in `Array.{{method}}()`.', [SUGGESTION_REMOVE]: 'Remove the second argument.', [SUGGESTION_BIND]: 'Use a bound function.', }; @@ -70,107 +72,141 @@ const ignored = [ 'underscore.some', ]; -function removeThisArgument(callExpression, sourceCode) { - return fixer => removeArgument(fixer, callExpression.arguments[1], sourceCode); +function removeThisArgument(thisArgumentNode, sourceCode) { + return fixer => removeArgument(fixer, thisArgumentNode, sourceCode); } -function useBoundFunction(callExpression, sourceCode) { +function useBoundFunction(callbackNode, thisArgumentNode, sourceCode) { return function * (fixer) { - yield removeThisArgument(callExpression, sourceCode)(fixer); + yield removeThisArgument(thisArgumentNode, sourceCode)(fixer); - const [callback, thisArgument] = callExpression.arguments; - - const callbackParentheses = getParentheses(callback, sourceCode); + const callbackParentheses = getParentheses(callbackNode, sourceCode); const isParenthesized = callbackParentheses.length > 0; const callbackLastToken = isParenthesized ? callbackParentheses.at(-1) - : callback; + : callbackNode; if ( !isParenthesized - && shouldAddParenthesesToMemberExpressionObject(callback, sourceCode) + && shouldAddParenthesesToMemberExpressionObject(callbackNode, sourceCode) ) { yield fixer.insertTextBefore(callbackLastToken, '('); yield fixer.insertTextAfter(callbackLastToken, ')'); } - const thisArgumentText = getParenthesizedText(thisArgument, sourceCode); + const thisArgumentText = getParenthesizedText(thisArgumentNode, sourceCode); // `thisArgument` was a argument, no need add extra parentheses yield fixer.insertTextAfter(callbackLastToken, `.bind(${thisArgumentText})`); }; } -/** @param {import('eslint').Rule.RuleContext} context */ -const create = context => { - const {sourceCode} = context; - - return { - CallExpression(callExpression) { - if ( - !isMethodCall(callExpression, { - methods: [ - 'every', - 'filter', - 'find', - 'findLast', - 'findIndex', - 'findLastIndex', - 'flatMap', - 'forEach', - 'map', - 'some', - ], - argumentsLength: 2, - optionalCall: false, - optionalMember: false, - }) - || isNodeMatches(callExpression.callee, ignored) - || isNodeValueNotFunction(callExpression.arguments[0]) - ) { - return; - } - - const {callee} = callExpression; - const method = callee.property.name; - const [callback, thisArgument] = callExpression.arguments; - - const problem = { - node: thisArgument, - messageId: ERROR, - data: {method}, - }; - - const thisArgumentHasSideEffect = hasSideEffect(thisArgument, sourceCode); - const isArrowCallback = callback.type === 'ArrowFunctionExpression'; - - if (isArrowCallback) { - if (thisArgumentHasSideEffect) { - problem.suggest = [ - { - messageId: SUGGESTION_REMOVE, - fix: removeThisArgument(callExpression, sourceCode), - }, - ]; - } else { - problem.fix = removeThisArgument(callExpression, sourceCode); - } - - return problem; - } +function getProblem({ + sourceCode, + callExpression, + callbackNode, + thisArgumentNode, + messageId, +}) { + const problem = { + node: thisArgumentNode, + messageId, + data: { + method: callExpression.callee.property.name, + }, + }; + const isArrowCallback = callbackNode.type === 'ArrowFunctionExpression'; + if (isArrowCallback) { + const thisArgumentHasSideEffect = hasSideEffect(thisArgumentNode, sourceCode); + if (thisArgumentHasSideEffect) { problem.suggest = [ { messageId: SUGGESTION_REMOVE, - fix: removeThisArgument(callExpression, sourceCode), - }, - { - messageId: SUGGESTION_BIND, - fix: useBoundFunction(callExpression, sourceCode), + fix: removeThisArgument(thisArgumentNode, sourceCode), }, ]; + } else { + problem.fix = removeThisArgument(thisArgumentNode, sourceCode); + } + + return problem; + } - return problem; + problem.suggest = [ + { + messageId: SUGGESTION_REMOVE, + fix: removeThisArgument(thisArgumentNode, sourceCode), }, - }; + { + messageId: SUGGESTION_BIND, + fix: useBoundFunction(callbackNode, thisArgumentNode, sourceCode), + }, + ]; + + return problem; +} + +/** @param {import('eslint').Rule.RuleContext} context */ +const create = context => { + const {sourceCode} = context; + + // Prototype methods + context.on('CallExpression', callExpression => { + if ( + !isMethodCall(callExpression, { + methods: [ + 'every', + 'filter', + 'find', + 'findLast', + 'findIndex', + 'findLastIndex', + 'flatMap', + 'forEach', + 'map', + 'some', + ], + argumentsLength: 2, + optionalCall: false, + optionalMember: false, + }) + || isNodeMatches(callExpression.callee, ignored) + || isNodeValueNotFunction(callExpression.arguments[0]) + ) { + return; + } + + return getProblem({ + sourceCode, + callExpression, + callbackNode: callExpression.arguments[0], + thisArgumentNode: callExpression.arguments[1], + messageId: ERROR_PROTOTYPE_METHOD, + }); + }); + + // `Array.from()` + context.on('CallExpression', callExpression => { + if ( + !isMethodCall(callExpression, { + object: 'Array', + method: 'from', + argumentsLength: 3, + optionalCall: false, + optionalMember: false, + }) + || isNodeValueNotFunction(callExpression.arguments[1]) + ) { + return; + } + + return getProblem({ + sourceCode, + callExpression, + callbackNode: callExpression.arguments[1], + thisArgumentNode: callExpression.arguments[2], + messageId: ERROR_STATIC_METHOD, + }); + }); }; /** @type {import('eslint').Rule.RuleModule} */ diff --git a/test/no-array-method-this-argument.mjs b/test/no-array-method-this-argument.mjs index c2f8db1589..6cb708b5c9 100644 --- a/test/no-array-method-this-argument.mjs +++ b/test/no-array-method-this-argument.mjs @@ -9,12 +9,26 @@ test.snapshot({ 'new array.map(() => {}, thisArgument)', 'array.map?.(() => {}, thisArgument)', 'array?.map(() => {}, thisArgument)', + 'Array.unknownMethod(iterableOrArrayLike, () => {}, thisArgument)', + 'new Array.from(iterableOrArrayLike, () => {}, thisArgument)', + 'Array.from?.(iterableOrArrayLike, () => {}, thisArgument)', + 'Array?.from(iterableOrArrayLike, () => {}, thisArgument)', + 'NotArray.from(iterableOrArrayLike, () => {}, thisArgument)', + // More or less arguments 'array.map()', 'array.map(() => {},)', 'array.map(() => {}, ...thisArgument)', 'array.map(...() => {}, thisArgument)', 'array.map(() => {}, thisArgument, extraArgument)', + 'Array.from()', + 'Array.from(iterableOrArrayLike)', + 'Array.from(iterableOrArrayLike, () => {},)', + 'Array.from(iterableOrArrayLike, () => {}, ...thisArgument)', + 'Array.from(iterableOrArrayLike, ...() => {}, thisArgument)', + 'Array.from(...iterableOrArrayLike, () => {}, thisArgument)', + 'Array.from(iterableOrArrayLike, () => {}, thisArgument, extraArgument)', + // Ignored 'lodash.every(array, () => {})', 'lodash.find(array, () => {})', @@ -33,10 +47,13 @@ test.snapshot({ // `jQuery.find` and `jQuery.filter` don't accept second argument '$( "li" ).filter( ":nth-child(2n)" ).css( "background-color", "red" );', '$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );', - // First argument is not function + // Callback argument is not function 'array.map(new Callback, thisArgument)', 'array.map(1, thisArgument)', 'async () => array.map(await callback, thisArgument)', + 'Array.from(iterableOrArrayLike, new Callback, thisArgument)', + 'Array.from(iterableOrArrayLike, 1, thisArgument)', + 'Array.from(iterableOrArrayLike, await callback, thisArgument)', ], invalid: [ 'array.every(() => {}, thisArgument)', @@ -48,11 +65,14 @@ test.snapshot({ 'array.flatMap(() => {}, thisArgument)', 'array.forEach(() => {}, thisArgument)', 'array.map(() => {}, thisArgument)', + 'Array.from(iterableOrArrayLike, () => {}, thisArgument)', // Comma 'array.map(() => {}, thisArgument,)', 'array.map(() => {}, (0, thisArgument),)', + 'Array.from(iterableOrArrayLike, () => {}, thisArgument,)', // Side effect 'array.map(() => {}, thisArgumentHasSideEffect())', + 'Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())', ], }); @@ -61,21 +81,36 @@ test.snapshot({ valid: [], invalid: [ 'array.map(callback, thisArgument)', + 'Array.from(iterableOrArrayLike, callback, thisArgument)', 'array.map(callback, (0, thisArgument))', + 'Array.from(iterableOrArrayLike, callback, (0, thisArgument))', 'array.map(function () {}, thisArgument)', + 'Array.from(iterableOrArrayLike, function () {}, thisArgument)', 'array.map(function callback () {}, thisArgument)', + 'Array.from(iterableOrArrayLike, function callback () {}, thisArgument)', { code: 'array.map( foo as bar, (( thisArgument )),)', parser: parsers.typescript, }, + { + code: 'Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),)', + parser: parsers.typescript, + }, { code: 'array.map( (( foo as bar )), (( thisArgument )),)', parser: parsers.typescript, }, + { + code: 'Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)', + parser: parsers.typescript, + }, 'array.map( (( 0, callback )), (( thisArgument )),)', + 'Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)', // This callback is actually arrow function, but we don't know 'array.map((0, () => {}), thisArgument)', + 'Array.from(iterableOrArrayLike, (0, () => {}), thisArgument)', // This callback is a bound function, but we don't know 'array.map(callback.bind(foo), thisArgument)', + 'Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument)', ], }); diff --git a/test/snapshots/no-array-method-this-argument.mjs.md b/test/snapshots/no-array-method-this-argument.mjs.md index 1bea6b9f43..9d9e3c3993 100644 --- a/test/snapshots/no-array-method-this-argument.mjs.md +++ b/test/snapshots/no-array-method-this-argument.mjs.md @@ -193,7 +193,28 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array#map()\`.␊ ` -## invalid(10): array.map(() => {}, thisArgument,) +## invalid(10): Array.from(iterableOrArrayLike, () => {}, thisArgument) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, () => {}, thisArgument)␊ + ` + +> Output + + `␊ + 1 | Array.from(iterableOrArrayLike, () => {})␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, () => {}, thisArgument)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ` + +## invalid(11): array.map(() => {}, thisArgument,) > Input @@ -214,7 +235,7 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array#map()\`.␊ ` -## invalid(11): array.map(() => {}, (0, thisArgument),) +## invalid(12): array.map(() => {}, (0, thisArgument),) > Input @@ -235,7 +256,28 @@ Generated by [AVA](https://avajs.dev). | ^^^^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array#map()\`.␊ ` -## invalid(12): array.map(() => {}, thisArgumentHasSideEffect()) +## invalid(13): Array.from(iterableOrArrayLike, () => {}, thisArgument,) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, () => {}, thisArgument,)␊ + ` + +> Output + + `␊ + 1 | Array.from(iterableOrArrayLike, () => {},)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, () => {}, thisArgument,)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ` + +## invalid(14): array.map(() => {}, thisArgumentHasSideEffect()) > Input @@ -254,6 +296,25 @@ Generated by [AVA](https://avajs.dev). 1 | array.map(() => {})␊ ` +## invalid(15): Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect()) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())␊ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/1: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, () => {})␊ + ` + ## invalid(1): array.map(callback, thisArgument) > Input @@ -277,7 +338,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map(callback.bind(thisArgument))␊ ` -## invalid(2): array.map(callback, (0, thisArgument)) +## invalid(2): Array.from(iterableOrArrayLike, callback, thisArgument) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, callback, thisArgument)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, callback, thisArgument)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, callback)␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, callback.bind(thisArgument))␊ + ` + +## invalid(3): array.map(callback, (0, thisArgument)) > Input @@ -300,7 +384,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map(callback.bind((0, thisArgument)))␊ ` -## invalid(3): array.map(function () {}, thisArgument) +## invalid(4): Array.from(iterableOrArrayLike, callback, (0, thisArgument)) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, callback, (0, thisArgument))␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, callback, (0, thisArgument))␊ + | ^^^^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, callback)␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, callback.bind((0, thisArgument)))␊ + ` + +## invalid(5): array.map(function () {}, thisArgument) > Input @@ -323,7 +430,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map(function () {}.bind(thisArgument))␊ ` -## invalid(4): array.map(function callback () {}, thisArgument) +## invalid(6): Array.from(iterableOrArrayLike, function () {}, thisArgument) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, function () {}, thisArgument)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, function () {}, thisArgument)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, function () {})␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, function () {}.bind(thisArgument))␊ + ` + +## invalid(7): array.map(function callback () {}, thisArgument) > Input @@ -346,7 +476,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map(function callback () {}.bind(thisArgument))␊ ` -## invalid(5): array.map( foo as bar, (( thisArgument )),) +## invalid(8): Array.from(iterableOrArrayLike, function callback () {}, thisArgument) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, function callback () {}, thisArgument)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, function callback () {}, thisArgument)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, function callback () {})␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, function callback () {}.bind(thisArgument))␊ + ` + +## invalid(9): array.map( foo as bar, (( thisArgument )),) > Input @@ -369,7 +522,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map( (foo as bar).bind((( thisArgument ))),)␊ ` -## invalid(6): array.map( (( foo as bar )), (( thisArgument )),) +## invalid(10): Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, foo as bar,)␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, (foo as bar).bind((( thisArgument ))),)␊ + ` + +## invalid(11): array.map( (( foo as bar )), (( thisArgument )),) > Input @@ -392,7 +568,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map( (( foo as bar )).bind((( thisArgument ))),)␊ ` -## invalid(7): array.map( (( 0, callback )), (( thisArgument )),) +## invalid(12): Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, (( foo as bar )),)␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, (( foo as bar )).bind((( thisArgument ))),)␊ + ` + +## invalid(13): array.map( (( 0, callback )), (( thisArgument )),) > Input @@ -415,7 +614,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map( (( 0, callback )).bind((( thisArgument ))),)␊ ` -## invalid(8): array.map((0, () => {}), thisArgument) +## invalid(14): Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, (( 0, callback )),)␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, (( 0, callback )).bind((( thisArgument ))),)␊ + ` + +## invalid(15): array.map((0, () => {}), thisArgument) > Input @@ -438,7 +660,30 @@ Generated by [AVA](https://avajs.dev). 1 | array.map((0, () => {}).bind(thisArgument))␊ ` -## invalid(9): array.map(callback.bind(foo), thisArgument) +## invalid(16): Array.from(iterableOrArrayLike, (0, () => {}), thisArgument) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, (0, () => {}), thisArgument)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, (0, () => {}), thisArgument)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, (0, () => {}))␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, (0, () => {}).bind(thisArgument))␊ + ` + +## invalid(17): array.map(callback.bind(foo), thisArgument) > Input @@ -460,3 +705,26 @@ Generated by [AVA](https://avajs.dev). Suggestion 2/2: Use a bound function.␊ 1 | array.map(callback.bind(foo).bind(thisArgument))␊ ` + +## invalid(18): Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument) + +> Input + + `␊ + 1 | Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument)␊ + ` + +> Error 1/1 + + `␊ + > 1 | Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument)␊ + | ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 1/2: Remove the second argument.␊ + 1 | Array.from(iterableOrArrayLike, callback.bind(foo))␊ + ␊ + --------------------------------------------------------------------------------␊ + Suggestion 2/2: Use a bound function.␊ + 1 | Array.from(iterableOrArrayLike, callback.bind(foo).bind(thisArgument))␊ + ` diff --git a/test/snapshots/no-array-method-this-argument.mjs.snap b/test/snapshots/no-array-method-this-argument.mjs.snap index 2887aae2ae..cace872995 100644 Binary files a/test/snapshots/no-array-method-this-argument.mjs.snap and b/test/snapshots/no-array-method-this-argument.mjs.snap differ