Skip to content

Missing parentheses for ((let) of []); #10828

@fisker

Description

@fisker

Prettier 2.2.1
Playground link

--parser babel

Input:

for ((let) of []);

Output:

for (let of []);

Second Output:

SyntaxError: Unexpected token, expected ";" (1:13)
> 1 | for (let of []);
    |             ^
  2 | 

The parens are also needed in for ((let) of []); and for ((let.foo.bar) of []);.

See https://tc39.es/ecma262/#sec-for-in-and-for-of-statements

Originally posted by @thorn0 in #10777 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions