Skip to content

Enum Identifier node missing parent #381

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

Closed
SpainTrain opened this issue Mar 27, 2019 · 0 comments · Fixed by #383
Closed

Enum Identifier node missing parent #381

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

Comments

@SpainTrain
Copy link

What code were you trying to parse?

export enum SomeEnum {
    a
}

What did you expect to happen?

Node for SomeEnum identifier should have a .parent to inspect. E.g., as done in https://github.com/sindresorhus/eslint-plugin-unicorn/blob/79a8cd69669b94baec9f4864f08f6be0cac43805/rules/prevent-abbreviations.js#L436

What actually happened?

{ type: 'Identifier',
  name: 'SomeEnum',
  range: [ 12, 20 ],
  loc:
   { start: { line: 1, column: 12 }, end: { line: 1, column: 20 } } }
  eslint:linter An error occurred while traversing +2s
  eslint:linter Filename: /.../simple-test.ts +0ms
  eslint:linter Line: 1 +0ms
  eslint:linter Parser Options: { ecmaVersion: 9,
  ecmaFeatures: { globalReturn: false },
  sourceType: 'module',
  project: './tsconfig.json',
  tsConfigRootDir: './' } +0ms
  eslint:linter Parser Path: /.../node_modules/@typescript-eslint/parser/dist/parser.js +0ms
  eslint:linter Settings: {} +0ms
Cannot read property 'type' of undefined
Occurred while linting /.../simple-test.ts:1

Versions

package version
@typescript-eslint/typescript-estree 1.5.0
TypeScript 3.3.4000
node 10.15.3
npm 6.9.0

Possibly related to #370

@SpainTrain SpainTrain added package: typescript-estree Issues related to @typescript-eslint/typescript-estree triage Waiting for team members to take a look labels Mar 27, 2019
@bradzacher bradzacher added bug Something isn't working package: parser Issues related to @typescript-eslint/parser and removed package: typescript-estree Issues related to @typescript-eslint/typescript-estree triage Waiting for team members to take a look labels Mar 27, 2019
@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Feb 21, 2020
Luckeu pushed a commit to Luckeu/typescript-eslint that referenced this issue Jun 27, 2024
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