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

"service" import not treated the same as "inject as service"

Open elwayman02 opened this issue 1 year ago • 2 comments

In some lint rules, doing import { service } from '@ember/service'; is not detected the same as import { inject as service } from '@ember/service'; when determining if a service is in use.

For example, in order-in-routes, foo: service() has a different expected position whether or not inject as service was detected at the top of the file. Similarly, require-computed-property-dependencies treats services as a missing dependency if you used import { service }, but not if you used import { inject as service }.

The various linting rules that have handling for services need to be evaluated for this use-case to handle the new best practice around service imports.

https://api.emberjs.com/ember/5.4/functions/@ember%2Fservice/service

elwayman02 avatar Dec 14 '23 00:12 elwayman02

I think this is related to how many rules started out just looking for service() instead of actually checking the name it was imported. I fixed a lot rules (https://github.com/ember-cli/eslint-plugin-ember/issues/590) but not all.

bmish avatar Dec 14 '23 03:12 bmish