You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/template-no-action.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,25 @@ Examples of **correct** code for this rule:
42
42
</template>
43
43
```
44
44
45
+
```gjs
46
+
import action from './my-action-helper';
47
+
<template>
48
+
{{action this.handleClick}}
49
+
</template>
50
+
```
51
+
52
+
```gjs
53
+
<template>
54
+
{{#each items as |action|}}
55
+
<button {{action this.handleClick}}>x</button>
56
+
{{/each}}
57
+
</template>
58
+
```
59
+
60
+
## Strict-mode behavior
61
+
62
+
`action` is an ambient strict-mode keyword in Ember (registered in `STRICT_MODE_KEYWORDS`), so `{{action this.x}}` works in `.gjs`/`.gts` templates without an explicit import. The rule still flags those uses to discourage the deprecated keyword — but skips reports when `action` resolves to a JS-scope binding (an import or local declaration) or a template block param.
63
+
45
64
## Migration
46
65
47
66
- Replace `(action "methodName")` with method references or `(fn this.methodName)`
0 commit comments