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
IDE Parsing error when using overlapping globs #1394
Comments
can you tell me what version of IntelliJ you using? this seems similar to https://youtrack.jetbrains.com/issue/WEB-41250 but i don't see any active tickets on their side for this: https://youtrack.jetbrains.com/issues?q=parserOptions.project%20@typescript-eslint%2Fparser i'm using similar setup in both webstorm and intelij and i don't have this issue (its possible that there was fix for that in newer version of plugin) |
|
@kalbert312 to fix this issue you have to fix your tsconfig,
tsconfig.json
- "include": ["src"],
+ "include": ["./src/*"], |
That seems to have worked. Thanks. |
this should work in both cases - typescript determines the passed path is a directory, and treats it the same as If this is not working correctly, then it's probably a bug in our invalidation logic. I've got microsoft/TypeScript#35676 open to work with the MSFT team on a better way of doing the parsing logic |
issue seems to be present only if
This seems to not work well in IntelliJ, but it works when running from console. |
It'll always work from the console. This error will only be triggered from the IDE because the IDE is persistent, so it uses the program invalidation logic. There's the function When a new file is created, it doesn't exist in the program, so we have to detect this case and trigger typescript to recreate the program (same as when a file is deleted or moved/renamed). This was introduced in 2.0, because 2.0 had a breaking change in which we started throwing errors instead of creating a "catch-all" program when we encountered a file that wasn't within the tsconfigs given to us. We did this because this "catch-all" program path was slow (because it has to reparse a file's entire dependency tree), and there was no warnings when it was used; so it caused perf issues for many users. I need to add some I'll reopen this to keep track of this bug then. |
This also happens if "include" is left undefined, then all new files get this error until eslint is restarted |
This issue is weird: while (current !== next) {
current = next;
const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current);
if (folderWatchCallbacks) {
folderWatchCallbacks.forEach(cb =>
cb(currentDir, ts.FileWatcherEventKind.Changed),
);
hasCallback = true;
break;
}
next = canonicalDirname(current);
}
// force the immediate resync
updatedProgram = existingWatch.getProgram().getProgram();
sourceFile = updatedProgram.getSourceFile(filePath);
if (sourceFile) {
return updatedProgram;
} updatedProgram is present and sourceFile is falsly (it should find it) edit: This issue is present not only in Intellij products (can be reproduced in vscode) |
What code were you trying to parse?
New files added to the project
What did you expect to happen?
ESLint works
What actually happened?
Versions
@typescript-eslint/parser
2.10.0
TypeScript
3.7.4
ESLint
6.7.2
node
12.8.0
npm
6.13.4
.eslintrc.js
tsconfig.eslint.json
tsconfig.json
.env
(for create-react-app)The only fix this to restart the ESLint process in IntelliJ. Once it's restarted, eslint works just fine on all files in
src
no matter how deeply nested. As soon as I create a new file it comes back.Looks related to #1303 (comment)
The text was updated successfully, but these errors were encountered: