You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from Ember Cli 2.12 to 3.0 I get a lot of errors telling me to
4:12 error Use import { inject } from '@ember/service'; instead of using Ember.inject.service ember/new-module-imports
when running ember serve after the upgrade. I have gone trough a lot of these files and updated as told. Should the error notifications say to use import { inject as service } from '@ember/service'; instead?
The text was updated successfully, but these errors were encountered:
@Serabe I know a fix for the issue that was filed. However, upon investigating this and thinking about the rule a bit more, I came across other scenarios that wouldn't be reported or would be reported incorrectly. Here's one scenario that I've seen in older Ember applications:
importEmberfrom'ember';const{
Controller,// This variable line gets reported properly
computed,// This variable line gets reported, but it's incorrect because of its usage
inject // This variable line gets reported, but it's incorrect because of its usage}=Ember;exportdefaultController.extend({myService: inject.service('my-service'),someProperty: computed.readOnly('someOtherProperty')});
It seems that what should happen in the rule is that we should be looking for MemberExpressions that have a next child that is an Indentifier without any selectors. Right now, the selector this rule uses is MemberExpressions > Identifier[name=Ember]. This limits the rule to only look for expressions that begin with Ember.. Anything else gets ignored. I'm not sure if this was done on purpose because of some limitation/issue I can't think about at this moment.
Either way, when the time permits, I can try seeing if I can come up with a solution. Of course, if there is anyone else that wants to take a shot at this would be most welcomed.
bmish
changed the title
Check this issue
Issue with ember/new-module-imports rule
Aug 30, 2020
I'm going back home today. I'll try to check this at some point in the near future
emberjs/rfcs#273 (comment)
@pusle wrote:
After upgrading from Ember Cli 2.12 to 3.0 I get a lot of errors telling me to
when running ember serve after the upgrade. I have gone trough a lot of these files and updated as told. Should the error notifications say to use import { inject as service } from '@ember/service'; instead?
The text was updated successfully, but these errors were encountered: