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
Upgrading from 2.22.0 to 2.23.0 causes parsing to fail miserably #1753
Comments
Not a lot I can do with this. Could you please provide some more information? |
One thing that could be relevant: we have a codebase that's mixed language (some TypeScript, mostly JavaScript). The parser is struggling with all our JS files. |
I ran
It's getting confused by this kind of notation: class Foo extends Component {
handleSomeEvent = (event) => ... // <= the equals sign is confusing the parser
} |
What I don't quite understand is why typescript-eslint/parser is running for our JS files, since that's not in our config. I printed the config for our JS files and the word "typescript" doesn't appear in it at all. We apply TypeScript plugins/rules/parsers/etc for our TypeScript files only. |
Looks like this error is coming from espree (eslint's default parser), not from typescript-eslint? |
Looks like it, but like I said before, this wasn't a problem with earlier versions of typescript-eslint. Something changed in 2.23.0, because that's the only thing I changed in between the good behavior and the bad behavior. |
I don't know what to say - the stack points clearly at another package. Upgrading the version of our tooling has no bearing on what ESLint does internally, so there must be something else that's changed. If you provide more information, maybe I can help you look into this. |
Also - this is because class properties are not supported by espree. |
Yup, we use babel-eslint too. I'll keep digging here, but my results are very reproducible. I downgraded typescript-eslint back to version 2.22.0 and now linting works correctly again. |
Not sure if this is related, but I see a bunch of these messages every time I lint:
|
That line is from The plugin uses the configured parser to parse the dependencies of each and every file (including files in dependencies in node_modules). See previous thread on this message: #1333, which you commented on it looks like. |
If you can throw up a repro repo, then I might be able to help you investigate, but it's hard to provide any guidance or help as it stands. |
Yeah, we've already disabled some the import rules based on your doc. Thanks for writing that up. It looks like the parser is getting tripped up by lines that look like this:
I think this falls into the "TypeScript 3.8 isn't fully supported" bucket? |
I'm assuming that was a typo, as that code is not valid. export * as foo from './foo';
export * from './foo';
export { bar } from './foo'; 3.8's |
It wasn't a typo (we've had this code for years) but maybe this is a case of Babel supporting something that TypeScript doesn't. That line is taking the default export from another file and exporting it with a new name. |
That is not yet valid JS. The "correct" way to do this with valid ES2020 (and valid TS) code is |
Hmm, I need the export to be named
But now I'm getting even worse errors:
|
This comment has been minimized.
This comment has been minimized.
Any time you see the "... is invalid and will just be ignored" message, that's coming from eslint-plugin-import. I would consider just using our parser for everything, so that you don't have the inconsistent behaviour of using babel-eslint and typescript-eslint. But that would probably take a little bit of time to ensure you fix up anything non-standard that babel was handling for you (like the export default from). |
That's actually a pretty good idea. I'll dig into that today and see what I find. |
After digging all day, I feel pretty confident that the root issue is that we have a mixed-language codebase, where our JS files also have (dormant) Flow types. That's why we have both After some clean installs and clean package upgrades, I got the number of linting errors down to something very reasonable. All the errors were related to Flow rules being incorrectly applied to TS files. Once I updated our eslint config to not do that, everything passed. Sorry for the trouble and thanks a ton for your suggestions! |
no problem, glad we were able to get it all sorted! |
I'm not sure what's going on, but when I upgrade to the latest version of the typescript-eslint packages (including 2.24.0), linting fails on my entire codebase at a very low level. With version 2.22.0 or earlier, everything is fine. The errors all look like this:
What happened?
Versions
@typescript-eslint/parser
2.23.0
TypeScript
3.8.3
ESLint
6.8.0
node
12.16.1
npm
6.13.4
The text was updated successfully, but these errors were encountered: