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

[ember/no-side-effects] False-positive with an assignment in a lambda

Open boris-petrov opened this issue 4 years ago • 4 comments

public get foo(): object {
  return {
    bar: x => {
      this.x = x;
    },
  };
}

This leads to a ember/no-side-effects which is wrong.

boris-petrov avatar Apr 20 '21 08:04 boris-petrov

We had some previous discussions about this case in #915 and #917. At the time, we decided not to make any changes to the rule, because closures/lambdas did not seem like a reliable heuristic.

bmish avatar Apr 20 '21 15:04 bmish

Ah, sorry, I didn't see those. I'm fine if you close it as a wontfix. However, some support for this would be nice, as that's a pretty normal use-case I believe.

boris-petrov avatar Apr 20 '21 18:04 boris-petrov

I'll close for now since I don't have a perfect fix for it.

bmish avatar Apr 21 '21 19:04 bmish

@bmish - well, it's good to have an open issue for this so it's not forgotten but it's your choice. :)

boris-petrov avatar Apr 21 '21 20:04 boris-petrov