vue2.x版本报错error: ‘xxxx‘ is defined but never used (no-unused-vars)

在vue2.x中,只要是声明了变量没有使用或者引入了某个文件没有使用就会报错,这其实是语法校验规则。我们只需要关闭这种校验规则即可。
在项目中的package.json文件中找到rules,初始里面是空的,我们只需要加入以下内容即可:

"rules": {
    
    
   "generator-star-spacing": "off",
   "no-tabs":"off",
   "no-unused-vars":"off",
   "no-console":"off",
   "no-irregular-whitespace":"off",
   "no-debugger": "off"
 }

在这里插入图片描述
接着重启项目即可!

猜你喜欢

转载自blog.csdn.net/weixin_43729943/article/details/111477410