-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(typescript-estree): add EXPERIMENTAL_useProjectService option to use TypeScript project service #6754
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): add EXPERIMENTAL_useProjectService option to use TypeScript project service #6754
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 site configuration. |
packages/typescript-estree/src/create-program/createProjectService.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/createProjectService.ts
Outdated
Show resolved
Hide resolved
packages/typescript-estree/src/create-program/createProjectService.ts
Outdated
Show resolved
Hide resolved
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6754 +/- ##
==========================================
- Coverage 87.57% 87.47% -0.11%
==========================================
Files 377 379 +2
Lines 13201 13230 +29
Branches 3901 3906 +5
==========================================
+ Hits 11561 11573 +12
- Misses 1261 1279 +18
+ Partials 379 378 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Re-requesting review from @bradzacher because I applied a couple of small touchups & answered a question. But otherwise I feel comfortable merging this after we get v6 out the door (just to be safe & not conflict with the v6 release). Woop woop! 🚀 |
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.
may i ask what happened with this PR - is it merged now, or had it to be abandoned? |
This was unintentionally auto-closed when we merged the |
The base branch was changed.
Now that
Note that we're keeping the FYI @jakebailey - we're moving quickly this month! ⚡ |
https://github.com/typescript-eslint/typescript-eslint/milestone/10 has a small enough number of bugs -and no major architectural issues- reported that I feel comfortable merging this in. Hooray! 🚀 (knocking on wood, fingers crossed 🤞) |
unit_tests_tsserver: | ||
name: Run Unit Tests with Experimental TSServer | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
package: | ||
[ | ||
'eslint-plugin', | ||
'eslint-plugin-internal', | ||
'eslint-plugin-tslint', | ||
'typescript-estree', | ||
] | ||
env: | ||
COLLECT_COVERAGE: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- name: Install | ||
uses: ./.github/actions/prepare-install | ||
with: | ||
node-version: 18 | ||
- name: Build | ||
uses: ./.github/actions/prepare-build | ||
- name: Run unit tests for ${{ matrix.package }} | ||
run: npx nx test ${{ matrix.package }} --coverage=false | ||
env: | ||
CI: true | ||
TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER: true |
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.
PR Checklist
Overview
Creates an experimental ready-to-try-only-if-you-dare prototype implementation of #6575: using TypeScript's "project service" / server to create programs instead of our existing manual project creation. Doing so brings the "create program(s) for source files" part of typed linting towards how editors behave:
tsconfig.json
for each file (similar toparserOptions.project: true
)tsconfig.json
if one is not found applicable to the fileTechnical Details
In essence, this PR:
EXPERIMENTAL_useProjectService
option to typescript-estreeprocess.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER
can also enable the optioncreateParserSettings
to call to a newcreateProjectService
function lazily when the experimental option is enabled (thereby settingparseSettings.EXPERIMENTAL_projectService
)getProgramAndAST
to use that project service if it exists, with a newuseProgramFromProjectService
See https://github.com/JoshuaKGoldberg/repros/tree/cbe9d9c9b19c09b085a0be2024221b2d05753cc8 for a reproduction case showing this working.
Performance Comparison
Complete Project Linting
v6
62.976 s ± 0.479 s
65.383 s ± 0.226 s
31.169 s ± 0.401 s
Incremental Project Linting
eslint-plugin/src/rules/*.ts
8.552 s ± 0.100 s
9.525 s ± 0.084 s
packages/typescript-estree/src/create-program/*.ts
7.162 s ± 0.079 s
2.153 s ± 0.007 s
packages/website/**/*.tsx
9.955 s ± 0.080 s
3.714 s ± 0.029 s