-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
False Positive for Namespace Import in Vue SFC with Script Setup #740
Comments
This is basically a dup of #733 Knip only extracts import statements in the built-in "compilers", you'd need to install an actual compiler. And I need to document this properly :) |
Ah, thanks for the info. I read through most of the docs but somehow missed that 🤦 Unfortunately, I forked the repro and made those changes (after fixing the missing declaration of Wouldn't be surprised if I'm doing something wrong, but I'm still new to Knip and not very familiar with the vue sfc compiler. |
What does the compiled JS look like? The return value is what we're interested in, because that's what Knip is working with. |
Closing due to inactivity. |
@yishuolin Thanks, so you're having the same issue? That could very well be the cause indeed. Would you like submit a pull request? No worries if not and I'll investigate/pick it up later. |
@webpro I encountered a similar issue—Knip reports unused enumMembers if the enum member is used in a file compiled by a custom compiler. Here's a minimal reproduction. Apologies, but I might not be able to look into this issue at the moment, so I’ll need to hand it over to you. Thank you! |
@yishuolin @kirkbaly I might have a fix, would be great if you could test this version in your project(s):
|
Thanks for the fix! I tested it, and it worked perfectly in my project. |
Thank you so much for confirming. I'll release it today. |
🚀 This issue has been resolved in v5.37.1. See Release 5.37.1 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
Awesome! Sorry for the unresponsiveness, but thanks for the fix! Now to scan the template as well as the script... 😅 😂 |
Reproduction url
https://stackblitz.com/edit/github-bquuj6
Description of the issue
Knip does not detect used exports that are used via namespace imports in Vue SFCs with script setup.
In this example, Bar.bar is reported as unused, while Baz.baz is reported as used. Of course, the same import and usage of Bar in a TS file would be reported as used.
The text was updated successfully, but these errors were encountered: