From 5d346a2fa99b295c7aef6042d4f05bb2df4972b2 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:29:45 -0500 Subject: [PATCH] Extract rule: template-no-action --- README.md | 1 + docs/rules/template-no-action.md | 54 +++++++++++++++++++++ lib/rules/template-no-action.js | 70 +++++++++++++++++++++++++++ tests/lib/rules/template-no-action.js | 61 +++++++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 docs/rules/template-no-action.md create mode 100644 lib/rules/template-no-action.js create mode 100644 tests/lib/rules/template-no-action.js diff --git a/README.md b/README.md index 118014a552..fd7a909acf 100644 --- a/README.md +++ b/README.md @@ -247,6 +247,7 @@ rules in templates can be disabled with eslint directives with mustache or html | [no-observers](docs/rules/no-observers.md) | disallow usage of observers | ✅ | | | | [no-old-shims](docs/rules/no-old-shims.md) | disallow usage of old shims for modules | ✅ | 🔧 | | | [no-string-prototype-extensions](docs/rules/no-string-prototype-extensions.md) | disallow usage of `String` prototype extensions | ✅ | | | +| [template-no-action](docs/rules/template-no-action.md) | disallow {{action}} helper | | | | ### Ember Data diff --git a/docs/rules/template-no-action.md b/docs/rules/template-no-action.md new file mode 100644 index 0000000000..3b6f043820 --- /dev/null +++ b/docs/rules/template-no-action.md @@ -0,0 +1,54 @@ +# ember/template-no-action + + + +Disallows the use of `{{action}}` helper. + +The `{{action}}` helper is deprecated in favor of the `{{on}}` modifier and `{{fn}}` helper, which provide better performance and clearer intent. + +## Examples + +Examples of **incorrect** code for this rule: + +```gjs + +``` + +```gjs + +``` + +Examples of **correct** code for this rule: + +```gjs + +``` + +```gjs + +``` + +```gjs + +``` + +## Migration + +- Replace `(action "methodName")` with method references or `(fn this.methodName)` +- Replace `