quick-lint-js

Find bugs in JavaScript programs.

E0720: function 'let' call may be confused for destructuring; remove parentheses to declare a variable

In JavaScript, variables can be named let and interpreted as a function call if it is followed by parentheses. This code calls function let instead of destructuring an object:

const words = {first: "hello", second: "world"};
let ({first} = words);

If you want to declare a variable, remove the parentheses:

const words = {first: "hello", second: "world"};
let {first} = words;

Documentation for other errors