-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
fix: correctly detect JS projects with type checking #20944
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Is the assumption here, that if there's a
jsconfig.json
then there isn't also atsconfig.json
, and we're certain it's not a TS project? It sounds reasonable to me, but I just want to make sure. -
This only works if the
jsconfig.json
is in the CWD right, is that always the case? What about monorepos, is it valid to have ajsconfig.json
in a parent directory, that we would be missing here? Based on a quick glance athasDependency
it looks like we're already detectingpackage.json
in parent directories, so maybe we should do the same forjsconfig.json
Yeah, I don't know what TypeScript would do if you have both, but you really shouldn't have both.
Yes. I think even in a monorepo you always need a |
I did some research and it looks like it's actually perfectly valid to not have a import { getTsconfig } from 'get-tsconfig'
const hasJsConfig = Boolean(getTsconfig('.', 'jsconfig.json')); |
Thanks for finding that. I've made that change |
Tests are failing, it was of course too easy. Basically our tests for the detection mocks out I see two paths forward:
I'm okay with option 2, as some support for |
…norepo" This reverts commit e8b6e79.
I've gone back to the old way and added a TODO. I'm not sure how to add a test for this |
@JReinhold this seems fine to merge to me, WDYT? |
Closes #20595
What I did
Detected if
jsconfig.json
existsI also did some minor cleanup by removing an unnecessary
cwd
usage: https://nodejs.org/api/fs.html#string-pathsChecklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]