Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
elwayman02 opened this issue Dec 14, 2023 · 2 comments
Open

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

elwayman02 opened this issue Dec 14, 2023 · 2 comments
Labels

Comments

@elwayman02
Copy link

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 elwayman02 changed the title service decorator import not treated the same as "inject as service" "service" import not treated the same as "inject as service" Dec 14, 2023
@bmish bmish added the bug label Dec 14, 2023
@bmish
Copy link
Member

bmish commented Dec 14, 2023

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 (#590) but not all.

@bitxplora
Copy link

This import { service } from '@ember/service'; works for me; there is a need for more context on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants