typescript-eslint: [2.4.0][Watch][Windows] ESLint doesn't exit after completing a cli lint
Simply upgrading eslint-pluginand parser from 2.3.3 to 2.4.0 causes eslint to hang at the end of the processing.
npx eslint --cache --report-unused-disable-directives "./**/*.{js,jsx,ts,tsx}"
I’ve enabled basic debugging DEBUG=eslint:cli-engine and the last message is eslint:cli-engine Linting complete in: 110453ms +219ms and then the eslint command does not seem to return (within several minutes) and I can only kill the process.
I have tried this without any change to the sources to be parsed or the configuration and simply upgrading to 2.4.0 makes eslint hang and after moving back to 2.3.3 it does no longer hang.
(I’m aware that I should upload a reproducible test case but given the nature of this problem this seems not possible right now)
Versions
| package | version |
|---|---|
@typescript-eslint/eslint-plugin |
2.4.0 |
@typescript-eslint/parser |
2.4.0 |
TypeScript |
3.6.4 |
ESLint |
6.5.1 |
node |
12.12.0 |
npm |
6.12.0 |
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 36 (30 by maintainers)
Commits related to this issue
- fix(eslint-config): bump down eslint parser to fix macos/windows bug This is for https://github.com/typescript-eslint/typescript-eslint/issues/1079 — committed to favware/node-packages by favna 7 years ago
- build(deps): update versions Also locked @typescript-eslint/parser to 2.3.3 until https://github.com/typescript-eslint/typescript-eslint/issues/1079 is fixed Signed-off-by: Jeroen Claassens <j.claas... — committed to RWS-NL/air-node-packages by favna 7 years ago
- chore: lock typescript-eslint typescript-eslint/typescript-eslint#1079 — committed to kukhariev/node-uploadx by kukhariev 7 years ago
Running into this as well. macOS. Running with
--debugproduceseslint:cli-engine Linting complete in: 2301ms +6msbut it never exits.For reference:
.eslintrc.json
tsconfig.eslint.json
tsconfig.json
eslint
6.5.1the2.4.0version of the eslint typescript packages. It’s in an archetype project so there’s only 1 or 2 files to lint. Reverting to2.3.3fixed the issue for me.If you’re looking for a more robust way to disable watching, there is also a config you can add to your eslintrc -
parserOptions: {noWatch: true}. You need not rollback to 2.3.3.Should be pretty straightforward to add a Windows agent to the Azure Pipelines build, hopefully we can figure out a minimal repro to turn into a test
Thank you for the in-depth explanation all the good work! Sorry that I quite often (I know) report problem on the Windows platform but this is simply because our CI always runs on multiple MacOS AND Windows versions.
gah. windows. the one platform we don’t have any coverage on. This is more than likely the culprit. cc @JamesHenry - is it possible to add windows to the CI?
I’ll have to dust off my windows laptop and do some investigation.
When you run eslint, typescript will tell us which folders it wants us to watch. In
<2.4.0, we just no-oped that CB, because we thought we didn’t care about setting up watchers because eslint would provide us with the most up-to-date file contents. However this had a drawback with the 2.0.0 change we added to parse a stricter set of files - it meant that when you were in a long-running lint session (i.e. via an IDE), then typescript wouldn’t know that a new file should be included in the parse, and we would thus throw errors on valid files.2.4.0 adds support for weak file watching - it attaches watchers to the folders typescript cares about, as well as the
tsconfigfile(s). These watchers are set to be non-persistent - i.e. they are lightweight and will not hold the process open. But it looks like there’s something wrong on Windows specifically.chokidarwas supposed to handle the platform differences for me automatically, but I might have missed something in the docs.The environment variable does what it says on the tin - it turns off file watching within the parser (or more accurately
typescript-estree). I put it in because on some large, complex setups (like those with symlinks and such), file watching can have a pretty significant overhead, so you might want to turn it off for a single run.https://github.com/typescript-eslint/typescript-eslint/blob/1918024e86acdf315dbbe659af6fea5d7244b336/packages/typescript-estree/src/tsconfig-parser.ts#L99-L119
The problem we have is that eslint has no specific concept of a long running session, because it’s intended to be pretty stateless. This is why the watchers are setup always, because eslint has no mechanism to tell us that it’s being used in a long running use case.
Without, please.
Thank you! I’ll investigate this as soon as I can.
This is the output of eslint when running with
"extendedDiagnostics": truebut withoutPARSER_NO_WATCH=true: eslint.zip