Skip to content
This repository was archived by the owner on Oct 11, 2026. It is now read-only.
This repository was archived by the owner on Oct 11, 2026. It is now read-only.

10$: Warn on let ({x} = y); #1203

Closed
Closed

Description

@strager

Before refactor:

let x;
({x} = y);

After refactor:

let ({x} = y);  // Bug! This uses an undeclared variable 'x' and calls a function named 'let'.

Conditions for this diagnostic:

  • Function call with a variable let as the callee.
  • Exactly one function argument.
  • Function argument is an assignment expression with =.
  • Function argument's left-hand side is an object literal.

Activity

  1. added
    good first issueGood for newcomers and C++ beginners
    for hireGet paid for working on this task: https://quick-lint-js.com/hiring.html
    on Feb 21, 2024
  2. persimmonious commented on Feb 23, 2024

    @persimmonious
    Contributor

    @strager Shouldn't this be considered an error? Code like this crashes in Node.js on line 5:

    const y = {x: 45, z: "helloworld"};
    let z;
    ({z} = y);
    console.log(z);
    let ({x} = y);
    console.log(x);
    
  3. strager commented on Feb 24, 2024

    @strager
    CollaboratorAuthor

    @msharipov This doesn't crash:

    const y = {x: 45, z: "helloworld"};
    let z;
    ({z} = y);
    console.log(z);
    
    function let(arg) {
      console.log("let", arg);
    }
    let x;
    let ({x} = y);
    console.log(x);
  4. persimmonious commented on Feb 24, 2024

    @persimmonious
    Contributor

    @strager Ah, I see. Could you please assign this to me?

  5. Nyx1on commented on Mar 2, 2024

    @Nyx1on

    I claim this for-hire task. I expect payment after I complete this task. I will email the quick-lint-js team if I am assigned this task.

  6. strager commented on Mar 2, 2024

    @strager
    CollaboratorAuthor

    @Nyx1on Someone else already claimed this task. If @msharipov is unresponsive, I'll give the task you @Nyx1on.

  7. persimmonious commented on Mar 2, 2024

    @persimmonious
    Contributor

    I'm still working on this, it's just taking a while.

  8. added 3 commits that reference this issue on Mar 11, 2024
    62e3542
    fa7afec
    92e704e
  9. added a commit that references this issue on Mar 16, 2024
    c8b3258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for hireGet paid for working on this task: https://quick-lint-js.com/hiring.htmlgood first issueGood for newcomers and C++ beginners

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions