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

fix: ignore mirage directory for avoid-leaking-state-in-ember-objects

Open BarryThePenguin opened this issue 4 years ago • 2 comments

Unsure if this is the right approach for mirage.. but I thought I'd see what others think 💭

This code in mirage..

import { Factory } from 'ember-cli-mirage'

export default Factory.extend({
  foo: []
})

..has the same issues as the similar code in ember that this rule is trying to prevent..

export default Foo.extend({
  items: [],
});

..but the consequences aren't as bad, as mirage isn't normally run in production.

Though there is still the risk of leaking state in tests?

Fixes #202 Fixes #214

BarryThePenguin avatar Nov 11 '20 08:11 BarryThePenguin

I'd like to get @rwjblue's opinion on this.

bmish avatar Nov 19 '20 02:11 bmish

Suggestion - gate this behind a config flag? Maybe default to true is fine.

We've run into leaking state in tests plenty of times. Granted we've got ~4k tests running very split in ember exam, so some of that's on us 😢. Not currently using mirage, but I would think some teams would like to be able to config this if they do have test leak problems.

jaydgruber avatar Jan 22 '21 23:01 jaydgruber