-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Nested export *s cause false positives for unused export detection #62
Comments
This is by design. The values and types are re-exported through a namespace, and not used, so they're flagged as "unused exports/types in namespaces". Also see /~https://github.com/webpro/knip#too-many-unused-exports for possible ways to go about this. I'm interested to better understand why this is unexpected behavior and/or how to make it easier to deal with. |
Yeah this was surprising to me, and I didn't connect that the Too many unused exports section connected to it. The package is a utility library exported a collection of functions and types to be used by consumers. We use Let's say the package originally had one
|
Yes, that makes sense! I think the question here is whether Knip should ignore re-exports cq the files it re-exports from entry files (like in your example). And at this point I'm positive, I'll give it another thought and look into it shortly. |
Quick update. The upcoming v2 is progressing pretty well, but the refactoring I'm working on is quite the undertaking. Major improvements in performance though, while also fixing bugs like this one reported. |
Closing this as it should be fixed in v2 :) |
Coming over from JoshuaKGoldberg/ts-api-utils#33 (comment): it looks like the following chain is causing some false positives:
./src/index.ts
:export * from "./nodes/typeGuards/index.js"
./src/nodes/typeGuards/index.ts
:export * from "./compound"
(with or without a.js
extension)./src/nodes/typeGuards/compound.ts
: some exported functions...with the following
knip.jsonc
:git clone /~https://github.com/JoshuaKGoldberg/ts-api-utils cd ts-api-utils git checkout 3059705 pnpm install pnpm run lint:knip
cc @RebeccaStevens
The text was updated successfully, but these errors were encountered: