一、产生原因
在我们用 vue 脚手架创建项目时,会默认使用 ESLint 校验代码。
二、三种报错及解决方案
-
Newline required at end of file but not found eol-last
这句报错信息的含义是文件的末尾需要有空的一行。
解决方案:找到报错对应的位置,在最后加上一行空白。 -
Trailing spaces not allowed no-trailing-spaces
这句报错信息的含义是后面的空格太多了。
解决方案:
1.找到报错对应的位置,删除多余的空格。
2.找到 .eslintrc.js 文件,在 rules 字段中添加 ‘no-irregular-whitespace’: ‘off’ 关闭不规则的空格校验
rules: {
'no-irregular-whitespace': 'off'