1 error and 0 warnings potentially fixable with the `--fix` option。eslint报错解决方案

2,936 阅读1分钟

使用vue-cli脚手架时,选了eslint,然后开始写代码的时候,控制台就开始报错。

  5:2  error  Trailing spaces not allowed  no-trailing-spaces
  
  1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

image.png

其实是eslint在指出代码中的各种不规范,解决方法也简单,在package.json里修改一行代码:

"lint": "eslint --fix --ext .js,.vue src"

image.png

改完以后,发现没变化?不要急,重新npm启动你的项目,就会发现正常啦~

image.png

ps:偷懒不想输入代码启动项目木,也可以在package.json文件里,鼠标悬浮于serve上,然后点击运行脚本就可以启动项目。

image.png