eslint-plugin-ember
eslint-plugin-ember copied to clipboard
ember/no-assignment-of-untracked-properties-used-in-tracking-contexts should not be fixable
Since there are multiple ways to fix this error, the autofixer should not arbitrarily choose one. I had to disable this rule in the project I'm working on because it's adding calls to set()
when what I really needed to do was make the property @tracked
.
(As a side note, it also added an import from @ember/object
that conflicted with an existing import, causing a different lint error. There may be an unrelated problem with that rule.)
cc @bmish
(Can the autofixer read rule options? Maybe it could be off by default and the fix strategy could be configurable.)
Thanks for bringing this up. I am interested to consider how we can optimize our linting for Ember Octane best practices including using tracked properties.
If needed, we could have multiple autofixing strategies configurable by a rule option:
-
autofixStrategy
=set
- current fixing strategy, changesthis.x = 123
toset(this, 'x', 123)
for untracked properties -
autofixStrategy
=tracked
- potential new strategy, would add@tracked x
if it seesthis.x = 123
for an untracked property- Open question: Assuming the user is on Ember Octane, would this fix be safe, or would this always be too aggressive of a fix to make?
-
autofixStrategy
=none
- potential new strategy
There's another open question about what the default should be. Once all supported Ember LTS versions are 3.16 or above, we can change defaults to be targeted at Ember Octane.
@mongoose700 @rwjblue @Turbo87 thoughts?
I think the customizable autofix makes sense.
@bmish https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions might be relevant for this