-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
TSConfig' JSX option should not list react as an unlisted dependency #226
Comments
Yes, agreed. There are 6 values (excluding |
No, i'm using
Can you clarify why Full context: i have a monorepo, where most of the packages are in Typescript. Some of the packages use React, some don't. To avoid complexity and duplication, i have a single base tsconfig where i set every needed value and every package of the monorepo extends from that base tsconfig. I set the |
TypeScript compiles JSX to https://www.typescriptlang.org/tsconfig#jsx and https://www.typescriptlang.org/docs/handbook/jsx.html In theory it's possible that nothing in the source code imports In practice I guess there's almost always something explicitly importing something from So, here were we are. Balancing act, if you ask me. I'll dig into it some more and see if there's a way out for better handling of more use cases. And yes, maybe it'll end up in simply removing the
Knip complains a lot (aka false positives). It's still early days and figuring things out, as the JS/TS ecosystem is vast and honestly it's mostly heuristics based on things that sometimes work together in surprising ways. |
Eventually this behavior has been fixed. I think the pros outweigh the cons by not trying to be smart here. Thanks for raising this, @AndreaPontrandolfo :) |
@webpro Thank you for fixing it! |
Hello, thank you for this amazing tool!
I use a TSConfig for a typescript project and i specify the jsx option.
I don't have React as a dependency in the project because it's not needed.
Yet Knip complains that it's an "unlisted dependency".
I don't understand why is that.
I have no evidence that if you set the jsx option you are required to use React.
As a matter of fact, in my project nothing unexpected happens.
What
tsc
does is: if it encounters some React code during compilation, it look for that instruction and act accordingly. If the jsx instruction is not set by the user,tsc
will compile jsx with the default settings.If there is no react/jsx code in the project, but the jsx setting is set, nothing unexpected happens.
So i think this is a uninted behaviour by Knip.
Note: i don't think this is related to #186
The text was updated successfully, but these errors were encountered: