From b6d959e97c9fd19e16c43cc792fc490da942f349 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 17 Aug 2026 16:51:48 -0400 Subject: [PATCH 1/2] template-no-extra-mut-helper-argument is not hbs-only `mut` is an ambient strict-mode keyword, so `(mut a b)` is reachable in gjs/gts and the rule reports there. Adds a gjs test case. Co-Authored-By: Claude Opus 5 (1M context) --- docs/rules/template-no-extra-mut-helper-argument.md | 2 -- lib/rules/template-no-extra-mut-helper-argument.js | 2 +- .../rules/template-no-extra-mut-helper-argument.js | 12 ++++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/rules/template-no-extra-mut-helper-argument.md b/docs/rules/template-no-extra-mut-helper-argument.md index 3e18f04b2c..d7ea12e786 100644 --- a/docs/rules/template-no-extra-mut-helper-argument.md +++ b/docs/rules/template-no-extra-mut-helper-argument.md @@ -2,8 +2,6 @@ 💼 This rule is enabled in the 📋 `template-lint-migration` [config](https://github.com/ember-cli/eslint-plugin-ember#-configurations). -> **HBS Only**: This rule applies to classic `.hbs` template files only (loose mode). It is not relevant for `gjs`/`gts` files (strict mode), where these patterns cannot occur. - Disallows passing more than one argument to the `mut` helper. diff --git a/lib/rules/template-no-extra-mut-helper-argument.js b/lib/rules/template-no-extra-mut-helper-argument.js index 8fda9ca18e..ab9cb3683b 100644 --- a/lib/rules/template-no-extra-mut-helper-argument.js +++ b/lib/rules/template-no-extra-mut-helper-argument.js @@ -7,7 +7,7 @@ module.exports = { category: 'Possible Errors', recommended: false, url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/template-no-extra-mut-helper-argument.md', - templateMode: 'loose', + templateMode: 'both', }, fixable: null, schema: [], diff --git a/tests/lib/rules/template-no-extra-mut-helper-argument.js b/tests/lib/rules/template-no-extra-mut-helper-argument.js index 0307aca048..f01e4b52f9 100644 --- a/tests/lib/rules/template-no-extra-mut-helper-argument.js +++ b/tests/lib/rules/template-no-extra-mut-helper-argument.js @@ -45,6 +45,18 @@ ruleTester.run('template-no-extra-mut-helper-argument', rule, { }, ], }, + // `mut` is an ambient strict-mode keyword, so this reports in gjs/gts as well + { + filename: 'test.gjs', + code: '', + output: null, + errors: [ + { + message: + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + }, + ], + }, ], }); From a76df4002e58aea36106bdb564dc754847bfb2d9 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 17 Aug 2026 17:04:09 -0400 Subject: [PATCH 2/2] Stop recommending (action) in the mut message {{action}} was removed from ember-source, so the fix the message told people to write no longer exists. Points at (fn (mut attr) value) and updates the docs and fixtures to match. Co-Authored-By: Claude Opus 5 (1M context) --- .../template-no-extra-mut-helper-argument.md | 4 +- .../template-no-extra-mut-helper-argument.js | 2 +- .../template-no-extra-mut-helper-argument.js | 38 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/rules/template-no-extra-mut-helper-argument.md b/docs/rules/template-no-extra-mut-helper-argument.md index d7ea12e786..f46f3ecfc4 100644 --- a/docs/rules/template-no-extra-mut-helper-argument.md +++ b/docs/rules/template-no-extra-mut-helper-argument.md @@ -13,13 +13,13 @@ A common mistake when using the Ember handlebars template `mut(attr)` helper is This rule **forbids** the following: ```hbs -{{my-component click=(action (mut isClicked true))}} +{{my-component click=(fn (mut isClicked true))}} ``` This rule **allows** the following: ```hbs -{{my-component click=(action (mut isClicked) true)}} +{{my-component click=(fn (mut isClicked) true)}} ``` ## Related Rules diff --git a/lib/rules/template-no-extra-mut-helper-argument.js b/lib/rules/template-no-extra-mut-helper-argument.js index ab9cb3683b..4dbad15451 100644 --- a/lib/rules/template-no-extra-mut-helper-argument.js +++ b/lib/rules/template-no-extra-mut-helper-argument.js @@ -22,7 +22,7 @@ module.exports = { create(context) { const ERROR_MESSAGE = - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.'; + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.'; return { GlimmerSubExpression(node) { diff --git a/tests/lib/rules/template-no-extra-mut-helper-argument.js b/tests/lib/rules/template-no-extra-mut-helper-argument.js index f01e4b52f9..799a349b34 100644 --- a/tests/lib/rules/template-no-extra-mut-helper-argument.js +++ b/tests/lib/rules/template-no-extra-mut-helper-argument.js @@ -8,20 +8,20 @@ const ruleTester = new RuleTester({ ruleTester.run('template-no-extra-mut-helper-argument', rule, { valid: [ - '', - '', + '', + '', '', - '', - '', + '', + '', ], invalid: [ { - code: '', + code: '', output: null, errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], }, @@ -31,17 +31,17 @@ ruleTester.run('template-no-extra-mut-helper-argument', rule, { errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], }, { - code: '', + code: '', output: null, errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], }, @@ -53,7 +53,7 @@ ruleTester.run('template-no-extra-mut-helper-argument', rule, { errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], }, @@ -70,20 +70,20 @@ const hbsRuleTester = new RuleTester({ hbsRuleTester.run('template-no-extra-mut-helper-argument', rule, { valid: [ - '{{my-component click=(action (mut isClicked))}}', - '{{my-component click=(action (mut isClicked) true)}}', + '{{my-component click=(fn (mut isClicked))}}', + '{{my-component click=(fn (mut isClicked) true)}}', '{{my-component isClickedMutable=(mut isClicked)}}', - '', - '', + '', + '', ], invalid: [ { - code: '{{my-component click=(action (mut isClicked true))}}', + code: '{{my-component click=(fn (mut isClicked true))}}', output: null, errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], }, @@ -93,17 +93,17 @@ hbsRuleTester.run('template-no-extra-mut-helper-argument', rule, { errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], }, { - code: '', + code: '', output: null, errors: [ { message: - 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(action (mut attr) value)`.', + 'The handlebars `mut(attr)` helper should only have one argument passed to it. To pass a value, use: `(fn (mut attr) value)`.', }, ], },