I have a code like this:
const [contract, _customer, _payment] = await Promise.all([
api.signup.contract.sign(...),
api.signup.update(...),
api.payment.update(...),
]);
And eslint is complaining because of
118:15 warning '_customer' is assigned a value but never used @typescript-eslint/no-unused-vars
118:26 warning '_payment' is assigned a value but never used @typescript-eslint/no-unused-vars
I though that prefixing the var with _ was enought to explicetly ignore the var (meaning it’s not a mistake)
What would be the best way avoid this issue?
>Solution :
Making eslint ignore variables starting with an _ for the purposes of no-unused-vars tests is a configurable option:
no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]
… however, in this case since you only use the first value, simply don’t destructure the second and third:
const [contract] = await Promise.all([ //...