Skip to content

[Bug]: Sufficiently complex LValues allow let to incorrectly be used as an identifier name. #14317

@tolmasky

Description

@tolmasky

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

require("@babel/parser").parse("let [let = 5] = []")

RunKit link: https://runkit.com/tolmasky/let-allowed-in-lvalue

Configuration file name

No response

Configuration

No response

Current and expected behavior

Current behavior: No error
Expected behavior: Should get "'let' is not allowed to be used as a name in 'let' or 'const' declarations."

If you remove the initializer you'll see you correctly get this error.

Environment

  • Babel version: 7.17.3

Possible solution

This is fixed in #14320

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions