-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(typescript-estree): support long running lint without watch #1106
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
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
|
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.
Seems really promising, thanks a lot for all the effort that went into this!
@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! |
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.
setTimeout
function 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.stat
to 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:
options
andextra
into the functions by addingfilePath
toextra
.Video of it working perfectly in vscode: https://youtu.be/sg54KuUdw9U