简体   繁体   English

如何修复ESLint错误使用数组解构

[英]How to fix ESLint error Use array destructuring

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'. ESLint检查会抛出此行'使用数组解构'的错误。 How can I fix this error. 我该如何解决这个错误。

尝试这个

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

prefer-destructuring数组设置为false: https//eslint.org/docs/rules/prefer-destructuring

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM