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
+69-3Lines changed: 69 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,43 @@
6
6
7
7
Disallows the use of `{{action}}` helper.
8
8
9
+
"Action" is an overloaded term in Ember. Actions are methods on the `actions` hash, element modifiers that set up event handlers, partial-applied functions, and something we both pass downward and send back up. They have served many different purposes over the years, which makes them difficult to learn, teach, and repurpose.
Copy file name to clipboardExpand all lines: docs/rules/template-no-implicit-this.md
+76-4Lines changed: 76 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@
6
6
7
7
Require explicit `this` for property access in templates to avoid ambiguity.
8
8
9
-
## Rule Details
10
-
11
-
This rule requires explicitly using `this.` prefix for component properties and `@` prefix for named arguments in templates, avoiding ambiguous property references.
9
+
This rule aides in the migration path for [emberjs/rfcs#308](https://github.com/emberjs/rfcs/pull/308).
12
10
13
11
## Motivation
14
12
@@ -21,6 +19,78 @@ ambiguous, as it could be referring to a local variable (block param), a helper
21
19
with no arguments, a closed over component, or a property on the component
22
20
class.
23
21
22
+
Consider the following example where the ambiguity can cause issues:
23
+
24
+
You have a component class that looks like the following component and template:
25
+
26
+
```js
27
+
importComponentfrom'@ember/component';
28
+
importcomputedfrom'@ember/computed';
29
+
30
+
exportdefaultComponent.extend({
31
+
formatName:computed('firstName', 'lastName', function () {
32
+
return`${this.firstName}${this.lastName}`;
33
+
}),
34
+
});
35
+
```
36
+
37
+
```hbs
38
+
<h1>Hello {{formatName}}!</h1>
39
+
```
40
+
41
+
Given `{ firstName: 'Chad', lastName: 'Hietala' }`, Ember will render the
42
+
following:
43
+
44
+
```html
45
+
<h1>Hello Chad Hietala!</h1>
46
+
```
47
+
48
+
Now some time goes on and someone adds a `formatName` helper at
49
+
`app/helpers/formatName.js` that looks like the following:
0 commit comments