启动vue时ESlint报错

✘ 1 problem (1 error, 0 warnings)


Errors:
  1  http://eslint.org/docs/rules/no-trailing-spaces


  ✘  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
  </script>
            ^


✘ 2 problems (2 errors, 0 warnings)


Errors:
  1  http://eslint.org/docs/rules/eol-last
  1  http://eslint.org/docs/rules/no-trailing-spaces

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

把链接打开,发现都是一些书写不规范,可以按照提示,一一改正:

image.png

也可以直接关掉ESlint提示:
bulid/webpack.base.conf.js里面有配置如下:

module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),

点进config.dev.useEslint,发现在config/index.js里配置:

useEslint: true, // 改为false即可。

然后在重新执行:

cnpm run dev

成功:


image.png

参考资料:https://segmentfault.com/q/1010000007001988

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容