avoid-leaking-state-in-ember-objects is showing for ember-cli-mirage Factory objects
See original GitHub issueI’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
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.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
[QUESTION] Is it intended for
and especially this
to skip all
index.js
files without paying attention to where they are nested? I mean, that whensourceType
has value'script'
,linter
thinks that myusers/index.js
is not a module, but script, therefore it doesn’t allow forimport
export
keywordsParsing error: 'import' 'export' may appear only with 'sourceType: module'
I wouldn’t have noticed that if I didn’t copy pasted @rwjblue example. and of course, when I change back to
sourceType: 'module'
everything’s fine.Although it’s probably not even regarding ember, but eslint instead, but it’s worth a note I guess. I’m sorry in advance if something is not right in my post, I’m new to the business 🔢
I think it’s because the mirage folder is under
tests/dummy/
. I used this and it worked: