-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(typescript-estree): infer tsconfigRootDir from call stack #11370
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
feat(typescript-estree): infer tsconfigRootDir from call stack #11370
Conversation
|
Thanks for the PR, @JoshuaKGoldberg! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 718b881
☁️ Nx Cloud last updated this comment at |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11370 +/- ##
=======================================
Coverage 90.85% 90.86%
=======================================
Files 501 503 +2
Lines 50987 51028 +41
Branches 8410 8421 +11
=======================================
+ Hits 46324 46365 +41
Misses 4648 4648
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
||
| import pluginBase from '@typescript-eslint/eslint-plugin'; | ||
| import rawPlugin from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/raw-plugin'; | ||
| import { addCandidateTSConfigRootDir } from '@typescript-eslint/typescript-estree'; |
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.
this adds dependency on a transitive dep -- which will break consumers.
the dep needs to be listed in the package.json
there's something with our lint config -- there should be like import/no-extraneous-deps or something that's covering this.
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.
I think import-x would have caught this 😄

PR Checklist
tsconfigRootDirto the running flat config's directory if available #10841Overview
Adds a trio of logical pieces:
candidateTSConfigRootDirs: stores candidate root directories insidetypescript-estree, exposed viaadd*,clear*, andget*functionsget*,getInferredTSConfigRootDir, will throw an error if multiple candidates have been populated. It's only called bycreateParseSettingsif notsconfigRootDirwas explicitly provided.getTSConfigRootDirFromStack: given a call stack, gets the candidate directory hosting an ESLint config file -- if it can be foundcreateConfigsGetters: wraps the configs intypescript-eslintwith getters that pass the result ofgetRootDirFromStacktocandidateTSConfigRootDirsThe result is that using any configs like
tseslint.configs.recommendedTypeCheckedwill attempt to populate a candidatetsconfigRootDirfor parse settings.💖