-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
How to report files not used by other workspaces in a private monorepo? #140
Comments
Strictly spoken, the file is used, since it's imported from another file. What you're probably after (from the perspective of how Knip currently works) is two things:
Will keep this issue open to track interest. |
Oh, I must have put it wrong. It's not so much about the file, but unused code. I can see that in the following example
So I'm looking for a similar behavior even when you import another package in the monorepo. Like if instead of |
In that case you can use |
@webpro this does not seem to help... I created a repo with reproduction: https://github.com/zyulyaev/knip-playground |
Yes, that would come back to my first point of #140 (comment) |
I'm not so familiar with knip, but this does not sound relevant to my issue:
If you mean that in this example:
since As far as I understand the core issue here is that packages in a monorepo do not share any information about individual symbols/files being used by each other, right? I concluded that because when I removed But I think being able to track usages between packages in a monorepo could be very useful for cases when the packages are private. I obviously can't speak for the whole industry, but I feel like the pattern of having a single monorepo for everything a company creates has become pretty common. |
I think we mean the same thing, but now that I look it up I think I was mixing up the
Knip should see usage across packages in a monorepo. And I agree with the overall sentiment of "self-contained repos". Even just for finding "everything that's exported" it could be a useful flag. |
I've re-introduced the Any chance you could try it out on your project(s)? You can install with e.g. |
🚀 This issue has been resolved in v2.14.0. See Release 2.14.0 for release notes. |
Went ahead for this one and #142 and I think it's working as expected now :) Thanks again for reporting this. |
I run
I think Am I missing something? Is there any extra config should be set? 🤔 update: Yes, paths should be set and everything works fine now |
Consider the following monorepo structure:
And the content of the
/libs/shared/index.ts
is:Let's imagine neither frontend nor backend app uses the symbols exported by the
/libs/shared/bar.ts
file. The package is not published either, so there is absolutely no way for thebar
file to be used. However, it seems like knip considers it to be used since it is re-exported by the entry file (index.ts
).Is there a way for me to configure knip to report the
bar
file as unused?The text was updated successfully, but these errors were encountered: