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

fix(prefer-import-from-vue): skip side-effect import in .d.ts files #1907

Merged
merged 3 commits into from May 30, 2022

Conversation

antfu
Copy link
Member

@antfu antfu commented May 29, 2022

For example, in the dts generated by unplugin-vue-components, we use import '@vue/runtime-core' to let TypeScript aware of the context. I guess similar cases where ppl import without names, they are probably intentional to rely on its side-effects.

https://github.com/antfu/vitesse/blob/168fe3560999b1132f4b7a4ffa0a3a67859b0ca7/src/components.d.ts

@ota-meshi
Copy link
Member

ota-meshi commented May 30, 2022

Thank you for this PR!
However, prefer-import-from-vue rule is intended to prevent imports from failing in a stricter package manager.

#1780 (comment)

So I think we need to limit the behavior changes to d.ts. What do you think?

@antfu
Copy link
Member Author

antfu commented May 30, 2022

Yeah, that makes sense to me. I have updated the implementation, however I might need some help on testing against it.

Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
@FloEdelmann FloEdelmann changed the title fix(prefer-import-from-vue): skip side-effect import fix(prefer-import-from-vue): skip side-effect import in .d.ts files May 30, 2022
Copy link
Member

@ota-meshi ota-meshi left a comment

LGTM! Thank you!

@ota-meshi ota-meshi merged commit c1c9dc2 into master May 30, 2022
14 checks passed
@ota-meshi ota-meshi deleted the fix/prefer-import branch May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants