admin管理员组

文章数量:1289548

I have a line in my code :

this.someVar = document.querySelectorAll("div[container-type='some-container']")[0];

ESLint check throws error for this line 'Use array destructuring'. How can I fix this error.

I have a line in my code :

this.someVar = document.querySelectorAll("div[container-type='some-container']")[0];

ESLint check throws error for this line 'Use array destructuring'. How can I fix this error.

Share Improve this question asked Oct 7, 2018 at 12:09 Arvind KushwahaArvind Kushwaha 8192 gold badges11 silver badges19 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 9

Try this

([this.someVar] = document.querySelectorAll("div[container-type='some-container']"));

set prefer-destructuring array to false: https://eslint/docs/rules/prefer-destructuring

本文标签: javascriptHow to fix ESLint error Use array destructuringStack Overflow