Skip to content

Enum Identifier node missing parent #381

Closed
@SpainTrain

Description

@SpainTrain

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: parserIssues related to @typescript-eslint/parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions