-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
loadable-components with resolveComponent #522
Comments
On further thought, probably a plugin request. Should I close this and post to #483? |
Eventually this is based on a regular By the way, the fact that Knip no longer detects this is a result of the v4 refactoring. In v3 this might work as expected. Sooner or later I hope to find the time and re-implement some of |
Thanks! |
It does. Even more, v3 detects some unused exports v5 doesn't on our project. So I'm switching to it for now (though I didn't check if there are true positives which v5 detects and v3 doesn't; probably should do that before merging). |
If you don't already know cases like that, I'll try to minimize, but not sure it'll work; this is a large project and one I can't share if I can't minimize. |
The disadvantage of v3 is that it does not have the improved handling of namespace related cases that v5 has (https://knip.dev/blog/knip-v5). I had to make the sacrifice in order to allow this and future improvements and keep it fast. Feel free to set up cases you'd like to see covered, but no worries this point, you can also submit bug reports when it's (pre) released. |
Is there a way to see why v5 thinks a particular export is used (when v3 correctly detects it isn't)? |
Try |
+1 would love reimplementation of this in v5 (or v6) |
The challenge in this example case is that it requires the types of Just saying, dynamic imports in general should be handled fine by Knip, see these fixtures for examples: |
Hi @webpro - Loving Knip! I believe I've found another example of this issue: React Router lazy imports: const routes = [
{
path: "operations",
// This dynamic import isn't found, so Knip reports this file as unused.
lazy: () => import("../pages/ServiceCentersHandler"),
}
] Any suggestions? |
What's the issue/output? This usage of |
The output from knip with this pattern:
Each component that's lazy loaded this way shows as an unused export. |
I see, that seems to be a different issue, quite React Router specific? Feel free to open a new issue for this, ideally with a minimal reproduction. |
Thanks Lars! I just opened #556. |
🚀 This issue has been resolved in v5.3.0. See Release 5.3.0 for release notes. |
Please see https://knip.dev/guides/handling-issues#external-libs The case of @coryhouse is still not resolved unfortunately. I think it's an issue with either TypeScript or the types of the external lib. Rule of thumb: if "Find references" in the IDE (e.g. VS Code) does not find references, Knip will likely do the same. |
I am not sure if it should be considered a feature request or a bug (or a plugin request, for that matter).
In this
loadable-components
example if we removeLoadableOrange
Knip will mark
Apple
andOrange
as unused, butApple
is actually used (andOrange
is not).The text was updated successfully, but these errors were encountered: