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! 🚀 |
|
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 |



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.jsonfor each file (similar toparserOptions.project: true)tsconfig.jsonif one is not found applicable to the fileTechnical Details
In essence, this PR:
EXPERIMENTAL_useProjectServiceoption to typescript-estreeprocess.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVERcan also enable the optioncreateParserSettingsto call to a newcreateProjectServicefunction lazily when the experimental option is enabled (thereby settingparseSettings.EXPERIMENTAL_projectService)getProgramAndASTto use that project service if it exists, with a newuseProgramFromProjectServiceSee https://github.com/JoshuaKGoldberg/repros/tree/cbe9d9c9b19c09b085a0be2024221b2d05753cc8 for a reproduction case showing this working.
Performance Comparison
Complete Project Linting
v662.976 s ± 0.479 s65.383 s ± 0.226 s31.169 s ± 0.401 sIncremental Project Linting
eslint-plugin/src/rules/*.ts8.552 s ± 0.100 s9.525 s ± 0.084 spackages/typescript-estree/src/create-program/*.ts7.162 s ± 0.079 s2.153 s ± 0.007 spackages/website/**/*.tsx9.955 s ± 0.080 s3.714 s ± 0.029 s