其他分享
首页 > 其他分享> > eslint 踩坑 -- error '***' is assigned a value but never used no-unused-vars

eslint 踩坑 -- error '***' is assigned a value but never used no-unused-vars

作者:互联网

写代码的时候,遇到了这样的一个报错

 
 error  in ./src/views/CategoryEdit.vue
 
Module Error (from ./node_modules/eslint-loader/index.js):
 
D:\node-vue-moba\admin\src\views\CategoryEdit.vue
  24:11  error  'res' is assigned a value but never used  no-unused-vars
 
✖ 1 problem (1 error, 0 warnings)
✖ 1 problem (1 error, 0 warnings)
 
 
 @ ./src/router/index.js 4:0-53 13:15-27
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.0.121:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
 

 

错误原因:eslint的验证语法

解决办法:在错误语句后添加注释

// eslint-disable-line no-unused-vars

代码如下所示

 

 

这样就不报错了!

但是,如果页面有很多的 效验不通过,我们不会去选择 一个个的修改。所以,必要的时候要修改eslint 规则 (  https://www.cnblogs.com/yuerdong/p/15434113.html  )

 

标签:src,used,vars,no,value,js,unused,eslint,error
来源: https://www.cnblogs.com/yuerdong/p/15434139.html