-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(typescript-estree): adds support for project services using extended config files #9306
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): adds support for project services using extended config files #9306
Conversation
Thanks for the PR, @higherorderfunctor! 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 4478aea. 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 1 targetSent with 💌 from NxCloud. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v8 #9306 +/- ##
==========================================
+ Coverage 88.01% 88.04% +0.03%
==========================================
Files 401 402 +1
Lines 13637 13639 +2
Branches 3960 3959 -1
==========================================
+ Hits 12003 12009 +6
+ Misses 1325 1322 -3
+ Partials 309 308 -1
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 like the general direction! +1 on extracting out a getParsedConfigFile
, that's really useful. 🚀
Requesting changes mostly on reorganization, and the require()
ing too. Cheers!
packages/typescript-estree/src/create-program/getParsedConfigFile.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/tests/lib/createProjectService.test.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/getParsedConfigFile.ts
Outdated
Show resolved
Hide resolved
…ts with review feedback Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
👋 are you waiting on us for anything @higherorderfunctor? |
Nope! I'll be picking this back up this week / weekend. Had a vacation and some deadlines the last two weeks. |
Great! Let's time box this to a week from now, then - we really want to release v8 as soon as possible. |
Created Will revert most of the changes to Plan to be done by tonight. |
@JoshuaKGoldberg I will have some time tomorrow to check on the CI for any errors or for any final edits you would like to make. Thanks! |
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 is great, thanks!
I only have one teeny nit. It's absolutely not blocking at all. Will leave this open for a bit in case anybody else from the team has time to review.
packages/typescript-estree/src/create-program/getParsedConfigFile.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/getParsedConfigFile.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/getParsedConfigFile.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/getParsedConfigFile.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Brad Zacher <brad.zacher@gmail.com> Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
Co-authored-by: Brad Zacher <brad.zacher@gmail.com> Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
All changes made. Let me know if anything else! I think the running CI job is stuck, netlify shows complete. Opened #9641 for the test clean up. |
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.
🔥 thanks!
PR Checklist
Overview
packages/typescript-estree/src/create-program/createProjectService.ts
to usetsserver.getParsedCommandLineOfConfigFile
instead oftsserver.readConfigFile
to process extended tsconfigs.tsserver.getParsedCommandLineOfConfigFile
boilerplate frompackages/typescript-estree/src/create-program/useProvidedPrograms.ts
into a new filepackages/typescript-estree/src/create-program/getParsedConfigFile.ts
to keep the code DRY.packages/typescript-estree/tests/lib/createProjectService.test.ts
. Also adds a couple tests to round out coverage for uncommon code paths to bringgetParsedConfigFile.ts
to 100% (tsserver.sys === undefined
and triggeringgetCanonicalFileName
withtsserver.formatDiagnostics
).packages/typescript-estree/tests/fixtures/projectServicesComplex/
.A few implementation notes for the reviewer:
any
cast inpackages/typescript-estree/src/create-program/createProjectService.ts
. I left a code comment with reasoning for doing so. The originaltsserver.readConfigFile
was alsoany
with a hard cast.formatDiagnostics
in the newpackages/typescript-estree/src/create-program/getParsedConfigFile.ts
file was placed insidegetParsedConfigFile
. This was only to share the lazy import of tsserver. The existing Jest mocks seem to rely on tsserver being a lazy import. I'm not very familiar with eslint's module import cache-bypassing behavior, so I don't know if there is a performance implication here. The original lazy import is also still present inpackages/typescript-estree/tests/lib/createProjectService.test.ts
. We could try adding tsserver as a parameter togetParsedConfigFile
to remove the extra lazy import if we think it will be a problem.mock
to adoMock
inside abeforeAll
for testingtsserver.env === undefined
case. I've primarily used mocha/chai, vitest, and bun test; so if it there is a cleaner way to do this in jest I can make that update.packages/typescript-estree/tests/lib/createProjectService.test.ts
were truly unit tests mocking all calls to tsserver. Wanting to test the extends behavior, some of the tests now call through to tsserver. Since these are really testing integration functionality, please let me know if adjustments are required. These tests also have slightly looser assertions since tsserver adds some metadata. A code comment has been added to mark each.projectServicesComplex
fixture, specifically the project references. It may have future uses, but I can trim the currently unused project references if preferred.Inline comments work for me on the PR.