用vue手脚架生成的项目直接修改时.vue文件后,保存编译就报一大堆的错,解决方法:
一问题:
因为设置了eslint,如果你不想有规范的js代码,可以重新初始化关掉eslint。Use ESLint to lint your code? (Y/n) 这一步选no
如果你想有良好的规范,其实错误已经很清晰,大多数就是缩进不规范,分号不需要等原因,很容易解决的。写多了就成习惯了。
二、或在eslint中修改配置:
1 .禁止多个空行(no-multiple-empty-lines)
2. semi Extra semicolon(额外的分号)
3. Newline required at end of file but not found
4.Expect to indent the 2 spaces, but found that the 4
三、使用vue-cli脚手架构建了webpack项目,在开发过程中,Eslint验证太严谨了,想通过设置将这验证给关闭掉 ,操作如下:
在webpack.base.conf.js里面删掉下面:
preLoaders: [
{
test: /\.vue$/,
loader: 'eslint',
include: projectRoot,
exclude: [/node_modules/, /ignore_lib/]
},
{
test: /\.js$/,
loader: 'eslint',
include: projectRoot,
exclude: [/node_modules/, /ignore_lib/]
}
]
或者不想进行校验的文件就想上面一样创建一个ignore_lib,然后全部丢进去。