ember-cli / ember-cli/eslint-plugin-ember

avoid-leaking-state-in-ember-objects is showing for ember-cli-mirage Factory objects

Open
#202 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
263
Forks
214
Avg merge
30m
Merged PRs (30d)
5

Description

I've just upgraded `ember-cli` from `2.17.0` to `2.18.0`, and haver fixed most of the new linting errors (which are really informative, btw - thanks for that).

However, I'm seeing `ember/avoid-leaking-state-in-ember-objects` being flagged on an object that isn't an Ember object, and thus can't be fixed using the suggested workaround.

The class in question is an `ember-cli-mirage` `Factory`. Looking at the source code, it doesn't extend Ember's `CoreObject`, but is instead defined as:

```
let Factory = function() {
...
};
```

In addition, those Factories don't have an `init()` method, and nor does `Factory.extend` set any `_super` property, so section in the [docs for fixing `ember/avoid-leaking-state-in-ember-objects`](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/avoid-leaking-state-in-ember-objects.md) that show how to fix this wouldn't apply to these Factories.

We're using `ember-cli-mirage` `0.2.1`, but the latest source code (`0.4.1`) shows exactly the same issues.

Is there any way these errors can be removed globally for non-Ember objects, but kept for other Ember objects in the test folders, without having to add overrides on a file-by-file basis? Perhaps `isEmberObject` can be beefed up to check for more than just an `extend` method?

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.