1

I am getting the ESLint error (Use array destructuring. eslint(prefer-destructuring)) when I do:

let foo = 1;
foo = obj.data[i][1]; //ESLint error on this line

Can anyone please help to fix this?

1
  • 1
    Turn off that eslint rule, this warning is daft. Commented Nov 7, 2020 at 18:37

2 Answers 2

3

ESlint wants you to write

let foo = 1;
[, foo] = obj.data[i];

Whether that's actually better if up to you to decide. If you don't like it, turn off that rule instead.

Sign up to request clarification or add additional context in comments.

Comments

1

You can disable this rule by placing /* eslint-disable prefer-destructuring */ at the beginning of the file or try to destructure it:

let foo = 1;
[, foo] = obj.data[i];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.