eslint-plugin-ember icon indicating copy to clipboard operation
eslint-plugin-ember copied to clipboard

ember/no-assignment-of-untracked-properties-used-in-tracking-contexts applied on `@attr`

Open VincentMolinie opened this issue 3 years ago • 1 comments

The rule ember/no-assignment-of-untracked-properties-used-in-tracking-contexts is reporting error for codes like:

export default class EnvironmentPermissions extends Fragment {
  @service declare store: StoreService;

  @attr('number') declare environmentId: number;

  get environment(): Environment | null {
    return this.store.peekRecord('environment', this.environmentId);
  }

  set environment(value: Environment | null) {
    // Here I get the error
    this.environmentId = value && Number.parseInt(value.id, 10);
  }

But in the doc they don't talk about using set on model so I'm pretty sure it's a mistake

VincentMolinie avatar Nov 08 '22 16:11 VincentMolinie

It would be great if this linting rule would consider @attr as @tracked. There are probably other situations like these (e.g @dedupeTracked from tracked-toolbox), so perhaps it would be good to be able to constumize an ignore list somehow.

miguelcobain avatar Nov 15 '22 22:11 miguelcobain