问题记录
当我创建项目后,编写新的vue,然后运行,直接报一堆错
Elsint的格式检查非常的严格
解决方案
方案1 - 安装插件
在vscode中安装插件,ESLint和Prettier Standard
此时,再用vscode打开项目,即可看见红色波浪线错误
修复报错
方案2 - 修改.eslintrc.js,禁用检查
1.不允许有拖尾空格
报错:Trailing spaces not allowed no-trailing-spaces
// 关闭空格检查
'no-irregular-whitespace':'off'
2.预期缩进 2 个空格,但发现缩进 4 个空格
报错:Expected indentation of 2 spaces but found 4
在rules 字段中添加
//
'indent': ['off', 2],
参考文章:
1.vue项目中比较坑的点–Elisint的报错