feat(typescript-estree): support long running lint without watch#1106
Merged
bradzacher merged 5 commits intomasterfrom Oct 19, 2019
Merged
feat(typescript-estree): support long running lint without watch#1106bradzacher merged 5 commits intomasterfrom
bradzacher merged 5 commits intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1106 +/- ##
==========================================
+ Coverage 94.02% 94.09% +0.06%
==========================================
Files 115 120 +5
Lines 5123 5200 +77
Branches 1434 1442 +8
==========================================
+ Hits 4817 4893 +76
+ Misses 177 176 -1
- Partials 129 131 +2
|
JamesHenry
previously approved these changes
Oct 19, 2019
Member
JamesHenry
left a comment
There was a problem hiding this comment.
Seems really promising, thanks a lot for all the effort that went into this!
This was referenced Oct 19, 2019
|
@bradzacher thanks for all your work on this! I hadn't gotten back to this until now and it works like a charm in IntelliJ. Now I don't have to keep toggling my eslint integration off and on to pick up new and renamed files anymore. Much appreciated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1079
Fixes #1080
Fixes #1084
Fixes #1091
Fixes #1107
This PR does one main thing: it adds support for handling file updates without watchers.
It took the better part of an 8 hour session, but I figured it out.
I didn't even have to drop out of watch programs to do it.
There is a bit of noise on this PR, and I'm sorry for that. The important changes are on fa963c8.
f28e4dd was a quick refactor I did to help me look at the problem properly - all I did was move the various program creation functions we have into their own folders.
The solution in a nutshell.
setTimeoutfunction that the watch program uses. This let me turn the async 250ms queued updates into synchronous updates, which solved the huge problem with how it handled directory updates.typescript-eslint/packages/typescript-estree/src/create-program/createWatchProgram.ts
Lines 233 to 248 in 78025a3
fs.statto check for tsconfig changes instead of watching for changes.typescript-eslint/packages/typescript-estree/src/create-program/createWatchProgram.ts
Lines 253 to 266 in 78025a3
typescript-eslint/packages/typescript-estree/src/create-program/createWatchProgram.ts
Lines 273 to 282 in 78025a3
typescript-eslint/packages/typescript-estree/src/create-program/createWatchProgram.ts
Lines 294 to 324 in 78025a3
typescript-eslint/packages/typescript-estree/src/create-program/createWatchProgram.ts
Lines 333 to 363 in 78025a3
If my assumptions are correct, the cost of all of this should only be paid in watch mode, when a new file is encountered.
Other notes:
optionsandextrainto the functions by addingfilePathtoextra.Video of it working perfectly in vscode: https://youtu.be/sg54KuUdw9U