Skip to content
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

Cannot read property 'parent' of undefined when using enums without export #370

Closed
paolostyle opened this issue Mar 21, 2019 · 0 comments · Fixed by #383
Closed

Cannot read property 'parent' of undefined when using enums without export #370

paolostyle opened this issue Mar 21, 2019 · 0 comments · Fixed by #383
Labels
bug Something isn't working package: parser Issues related to @typescript-eslint/parser

Comments

@paolostyle
Copy link

Not quite sure if this is the proper package to report an issue but anyway...

What code were you trying to parse?

enum CellType {
  // it's irrelevant what's inside (I think?)
  String = 'string',
  Number = 'number'
}

// some functions later on

What did you expect to happen?
Nothing.

What actually happened?
This kind of error:

TypeError: Cannot read property 'parent' of undefined
Occurred while linting C:\src\src\utils\excelExport.ts:1
    at variable.defs.some.def (C:\src\node_modules\eslint\lib\rules\no-unused-vars.js:184:54)
    at Array.some (<anonymous>)
    at hasRestSpreadSibling (C:\src\node_modules\eslint\lib\rules\no-unused-vars.js:182:38)
    at collectUnusedVariables (C:\src\node_modules\eslint\lib\rules\no-unused-vars.js:578:80)
    at collectUnusedVariables (C:\src\node_modules\eslint\lib\rules\no-unused-vars.js:585:17)
    at Program:exit (C:\src\node_modules\eslint\lib\rules\no-unused-vars.js:630:36)
    at listeners.(anonymous function).forEach.listener (C:\src\node_modules\eslint\lib\util\safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (C:\src\node_modules\eslint\lib\util\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\src\node_modules\eslint\lib\util\node-event-generator.js:251:26)
Process finished with exit code -1

Everything is okay if I use export enum CellType. I'm extending recommended config so no-unused-vars from eslint should be disabled.

{
'@typescript-eslint/no-unused-vars': [
      'error',
      {
        vars: 'all',
        args: 'after-used',
        ignoreRestSiblings: true
      }
    ]
}

Versions

package version
@typescript-eslint/parser 1.5.0
TypeScript 3.3.3333
ESLint 5.15.3
node 10.13.0
npm 6.4.1
@paolostyle paolostyle added package: parser Issues related to @typescript-eslint/parser triage Waiting for maintainers to take a look labels Mar 21, 2019
@bradzacher bradzacher added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin and removed package: parser Issues related to @typescript-eslint/parser triage Waiting for maintainers to take a look labels Mar 24, 2019
@bradzacher bradzacher added package: parser Issues related to @typescript-eslint/parser and removed package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin labels Mar 27, 2019
@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: parser Issues related to @typescript-eslint/parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants