-
-
Notifications
You must be signed in to change notification settings - Fork 212
update ember/no-get fixer to support firstObject/foo.0.bar scenarios #1835
Copy link
Copy link
Closed
Labels
Description
when firstObject / lastObject / .0. are part of a string path inside a get, the fixer treats these as properties, where in reality these are ember syntax from array prototype extensions. These paths should either be ignored entirely, or changed to use array access.
// original
get(this, 'foo.firstObject.bar')
// bad ❌
this.foo.firstObject.bar;
// good ✅
this.foo[0].bar;
Same applies for lastObject and array based access foo.0.bar, which are all ember-specifics.
we have 2 options:
- update the fixer to ignore any path containing
firstObject/lastObject/.0. - update the fixer to convert these paths into array access like mentioned above.
could even do a combination of the above where they are only fixed if you specify a new configuration option like handleEmberArrayPrototypes
Reactions are currently unavailable