Skip to content

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

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy