启动vue时ESlint报错解决方案

开启vue项目,报了两个错
http://eslint.org/docs/rules/eol-last
http://eslint.org/docs/rules/no-trailing-spaces
看了一下,发现是代码不规范,我的是template后面尾随空行,和代码结尾少了个换行

C:\Users\xu\myProject>npm run dev

> [email protected] dev C:\Users\xu\myProject
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

 12% building modules 22/31 modules 9 active ...x=0!C:\Users\xu\myProject\src\App.vue{ parser: "babylon" } is deprecated; we now treat it as { parser: "bab 95% emitting

 WARNING  Compiled with 1 warnings                                                                            9:54:22 AM

  ✘  http://eslint.org/docs/rules/no-trailing-spaces  Trailing spaces not allowed
  src\components\HelloWorld.vue:6:1
   ^   
  ✘  http://eslint.org/docs/rules/eol-last            Newline required at end of file but not found
  src\components\HelloWorld.vue:16:10
  
            ^
✘ 2 problems (2 errors, 0 warnings)
Errors:
  1  http://eslint.org/docs/rules/eol-last
  1  http://eslint.org/docs/rules/no-trailing-spaces

解决方案

一、安装提示修改代码规范

二、直接关掉ESlint提示
可以看到在bulid/webpack.base.conf.js里面有配置如下:
在这里插入图片描述
config/index.js里配置 useEslint: false,就可以了启动vue时ESlint报错解决方案_第1张图片

你可能感兴趣的:(Vue.js)