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

Unused export inside exported namespace not reported #705

Open
sidu4u opened this issue Jun 27, 2024 · 5 comments
Open

Unused export inside exported namespace not reported #705

sidu4u opened this issue Jun 27, 2024 · 5 comments
Labels
feature request Feature request

Comments

@sidu4u
Copy link

sidu4u commented Jun 27, 2024

I have created a workspace to replicate this issue:

I have a namespace Parent with 2 exports Child1 and Child2. While Child1 is used in App.tsx. Child2 is unsed. Knip is not reporting Child2 as unused.

I have added issue types nsExports and nsTypes while running knip. Still not getting the unused Export

@sidu4u sidu4u added the bug Something isn't working label Jun 27, 2024
@webpro
Copy link
Collaborator

webpro commented Jun 27, 2024

Unfortunately namespaces are not supported yet. Just looked into it and did some preliminary work, but it's not trivial.

@webpro webpro added feature request Feature request and removed bug Something isn't working labels Jun 27, 2024
@sidu4u
Copy link
Author

sidu4u commented Jun 28, 2024

@webpro if namespaces are not supported why is there an issue type nsExport with description Namespace with export is referenced, but not export itself

@webpro
Copy link
Collaborator

webpro commented Jun 28, 2024

Good question, I need to document this better.

There's two different types of namespaces here:

  1. The import * as NS from '..' where NS is the namespace, which is what nsExports and https://knip.dev/guides/namespace-imports is about.
  2. The namespace feature of TypeScript (https://www.typescriptlang.org/docs/handbook/namespaces.html) which is not supported yet by Knip.

@sidu4u
Copy link
Author

sidu4u commented Jun 28, 2024

Is it ok if I open a PR for this, we are loving knip at work and will like to contribute.

@webpro
Copy link
Collaborator

webpro commented Jun 29, 2024

Absolutely! Let me know if you need any assistance.

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

No branches or pull requests

2 participants