-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: remove partial type-information program #6066
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
Conversation
Thanks for the PR, @bradzacher! 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. |
fc7e58f
to
d82bec2
Compare
f66f1e1
to
5ab70f1
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v6 #6066 +/- ##
==========================================
- Coverage 91.66% 91.64% -0.02%
==========================================
Files 354 354
Lines 12199 12200 +1
Branches 3581 3582 +1
==========================================
- Hits 11182 11181 -1
- Misses 721 722 +1
- Partials 296 297 +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.
🔥 Mostly looks fantastic - just requesting changes on the // backwards compatibility check
comment.
packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts
Show resolved
Hide resolved
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.
No remaining blockers, and a lot of goodness in this PR. Let's get this merged!! 🙌
Btw @bradzacher the |
For reference I just did a really quick perf test of the before-and-after for this. $ TSESTREE_SINGLE_RUN=true node --cpu-prof ./node_modules/.bin/eslint --no-eslintrc --parser="@typescript-eslint/parser" --ext=".ts,.tsx" . Loading the profiles into https://www.speedscope.app/ I can see that It doesn't seem like much, but our codebase is relatively small - ~2.6k files for ~207k SLOC in total. For a larger code base I'd expect more of an impact, though it'll likely still be pretty small overall. For reference the CPU profiles: PROFILES.zip |
BREAKING CHANGE:
[utils] sets
program = null
forgetParserServices(context, true)
.[typescript-estree] disallows
errorOnTypeScriptSyntacticAndSemanticIssues
ifproject
not providedPR Checklist
Overview
A few years ago I experimented with leveraging TS's unused variable diagnostics to power a lint rule. As this diagnostic is "single-file", I added the ability for the parser to generate a program in "isolated" mode (i.e. no
parserOptions.project
required and types/diagnostics only produced for the single file) as well as the ability for plugins to interact with this program.However this approach had some major drawbacks:
We never bothered going back to cleanup this work (until now).
This PR:
ts.SourceFile
s if we're not doing type-aware linting.getParserServices
util as appropriatesemantic-diagnostics-enabled
test because it's a test that we don't get any value out of - it's just emitting TS errors which might change from version to versionerrorOnTypeScriptSyntacticAndSemanticIssues
if we have full type info.