typescript-eslint: Regression in 2.24.0: TypeError: Cannot read property 'name' of undefined
What code were you trying to parse?
This seems to be an issue with barrel files, and was likely introduced by https://github.com/typescript-eslint/typescript-eslint/commit/133f622f38a286eac45288a9789d2ee529d5e582#diff-68b2b0b0d2d0ff1846b1114472008332R1606
export * from './app/foo';
What did you expect to happen?
No error.
What actually happened?
myrepo\src\public_api.ts
0:0 error Parsing error: Cannot read property 'name' of undefined
Running with --debug gives the following (clipped for brevity):
eslint:file-enumerator Yield: public_api.ts +51ms
eslint:cascading-config-array-factory Load config files for myrepo\src. +52ms
eslint:cascading-config-array-factory Cache hit: myrepo\src. +6ms
eslint:cli-engine Lint myrepo\src\public_api.ts +50ms
eslint:linter Linting code for myrepo\src\public_api.ts (pass 1) +26ms
eslint:linter Verify +8ms
eslint:linter With ConfigArray: myrepo\src\public_api.ts +2ms
eslint:linter Parsing error: Cannot read property 'name' of undefined
eslint:linter TypeError: Cannot read property 'name' of undefined
at Converter.convertNode (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:1247:67)
at Converter.converter (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:72:29)
at Converter.convertChild (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:147:21)
at myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:203:32
at Array.map (<anonymous>)
at Converter.convertBodyExpressions (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:202:14)
at Converter.convertNode (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:441:32)
at Converter.converter (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:72:29)
at Converter.convertProgram (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:47:21)
at Object.astConverter (myrepo\node_modules\@typescript-eslint\typescript-estree\dist\ast-converter.js:26:29) +9ms
Versions
| package | version |
|---|---|
@typescript-eslint/typescript-estree |
2.24.0 |
TypeScript |
3.7.5 |
node |
13.9.0 |
npm |
yarn 1.22.1 |
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 10
- Comments: 18 (9 by maintainers)
Commits related to this issue
- build(dep): revert to `eslint/parser` `2.23.0`: - https://github.com/typescript-eslint/typescript-eslint/issues/1746 — committed to PhilippeMorier/talus by PhilippeMorier 7 years ago
- build(dep): update outdated dependencies (#43) * build(dep): bump `@nestjs` to `7.0.3` * build(dep): bump `@nrwl` to `9.1.2` * build(dep): bump div dep * build(dep): bump @angular cdk & mate... — committed to PhilippeMorier/talus by PhilippeMorier 7 years ago
If you’re stuck on ts 3.7, then downgrade to 2.23.0. If you can upgrade to 3.8, then doing so will fix it.
I have a fix ready, but due to a glitch in azure, our per commit canary release is broken. So this will go out with our regular release schedule, listed on our readme.
My workaround was to downgrade to
2.23.0.Any advice on how to downgrade when this is included with create-react-app? This is breaking all builds at the moment.
@JamesHenry managed to fix the canary pipeline 🎉
The fix for this is now released to the
canarytag on npm. Will be released to the main tag as per our regular release schedule.It looks like
SyntaxKind.NamespaceExportisundefined, which is causing thenode.exportClause?.kind === SyntaxKind.NamespaceExportexpression to be truthy. Is this because I am using typescript 3.7 instead of 3.8?I’ve upgraded to TS 3.8 (even 3.9 nightly), no avail. Tried the resolutions, still no avail. I’m still getting the same error.
Thanks. Confirming forcing version 2.23.0 manually as well as through Yarn resolutions for the following now works.
“resolutions”: { “@typescript-eslint/eslint-plugin”: “2.23.0”, “@typescript-eslint/parser”: “2.23.0”, “@typescript-eslint/typescript-estree”: “2.23.0” },
Just wondering, any ETA for a new version with the fix?
In my case I’m using
create-react-appwhich only includesreact-scriptsin this manner (and all the logic is handled by react-scripts), and I have no idea how to change version separately.Thanks for the response. I will work on trimming down my repo to a minimal example and get back to you.