Open DArrigoni opened 1 year ago
After some more playing around with it I'm getting inconsistent results with this. Some times it works fine, sometimes it does not.
I've just come across the same issue. It seems this is because of the ignoreLeakingState
option in the config. This looks like it only supports queryParams
by default even though in the README it calls out queryParams
and actions
.
Ember Objects with objects or arrays as direct properties (actions and queryParams are the exception). See eslint-plugin-ember/avoid-leaking-state-in-ember-objects for more details.
Adding actions
to ignoreLeakingState
options does go a step further and do a migration but in my testing it looks like it translates to actions = { ... }
@gitKrystan should actions
be added as a default option in ignoreLeakingState
?
Did a bit more digging and it seems the codemod supports actions using ObjectMethod
notation but not FunctionExpression
.
actions: {
foo() {}
}
actions: {
foo: function() {}
}
I'll see about putting together a PR
Edit: hmm weirdly i can't replicate this behaviour in the tests
IIRC adding something to ignoreLeakingState
means it won't be transformed from an object literal. The actions
hash is special-cased, as you found.
Are you seeing anything about this file in codemods.log?
I have a file with an actions hash that is kicking out this error:
I'm assuming that the issue is something that fixing the "Could not find runtime data" error would resolve, although it works fine if I remove the actions hash and run it without it.
I'm invoking it with:
npx ember-native-class-codemod http://localhost:4202/partner/ app/controllers/authenticated/customers/index.js
And I can verify the app is loaded at
http://localhost:4202/partner/
Any assistance would be greatly appreciated.