-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(typescript-estree): don't throw on missing tsconfig.json by default in project service #9989
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(typescript-estree): don't throw on missing tsconfig.json by default in project service #9989
Conversation
…lt in project service
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 site configuration. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 318279b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9989 +/- ##
=======================================
Coverage 88.67% 88.67%
=======================================
Files 425 425
Lines 14797 14799 +2
Branches 4302 4304 +2
=======================================
+ Hits 13121 13123 +2
Misses 1533 1533
Partials 143 143
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 have been troubleshooting this issue on my side without realizing there was an open issue/pr to already fix that. I was checking about the fix and wondering about the I don't want to overstep, but I have tested the following solution (closer to what was done in 8.4) if (options.allowDefaultProject?.length) {
log('Enabling default project: %s', options.defaultProject);
let configFile: ts.ParsedCommandLine;
try {
configFile = getParsedConfigFile(
tsserver,
options.defaultProject,
tsconfigRootDir,
);
} catch (error) {
throw new Error(
`Could not read project service default project '${options.defaultProject}': ${(error as Error).message}`,
);
}
service.setCompilerOptionsForInferredProjects(
// NOTE: The inferred projects API is not intended for source files when a tsconfig
// exists. There is no API that generates an InferredProjectCompilerOptions suggesting
// it is meant for hard coded options passed in. Hard asserting as a work around.
// See https://github.com/microsoft/TypeScript/blob/27bcd4cb5a98bce46c9cdd749752703ead021a4b/src/server/protocol.ts#L1904
configFile.options as ts.server.protocol.InferredProjectCompilerOptions,
);
} Which will only try to parse the config if we actually want to use a defaultProject. |
ef3384e
into
typescript-eslint:main
PR Checklist
projectService: true
#9985Overview
Changes error throwing to only occur if the user explicitly provides a
parserOptions.defaultProject
.💖