🔧 The --fix
option on the command line can automatically fix some of the problems reported by this rule.
Using array prototype extension properties like {{list.firstObject.name}}
, {{list.lastObject}}
is discouraged and is likely to be deprecated soon.
This rule recommends the use of Ember's get
helper as an alternative for accessing array values.
This rule forbids the following:
This rule allows the following:
This rule forbids the following:
This rule allows the following:
Use JS approach
import Component from '@glimmer/component';
export default class SampleComponent extends Component {
abc = ['x', 'y', 'z', 'x'];
get lastObj() {
return abc[abc.length - 1];
}
}
Then in your template
Or if you have ember-math-helpers addon included: