Skip to content

Contextual keyword tokens being parsed as Keyword instead of Identifier #1501

Closed as not planned
@bradzacher

Description

@bradzacher

acornjs/acorn#902

In #1487 we made a change to mark all keywords output as Keyword tokens.
I've since learned that this was incorrect for some of them.

There are keywords which are classed as "contextual keywords". These keywords are keywords when they're in a their keyword position, and identifiers when they're in an identifier position.

So we need to either:

  • provide context to the token parser so it can create the correct token, or
  • always parse them as Identifier tokens (this is the route that espree/acorn takes)

The list of contextual keywords:
https://github.com/microsoft/TypeScript/blob/eeff036519362513cc86a95e260a281a725295f4/src/compiler/types.ts#L255-L285

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis change will require a new major version to be releasedbugSomething isn't workingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreewontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions