Vue express项目npm run dev报错:ESlint Missing的解决方法

今天用 Vue 脚手架 Vue CLI 拉了一个 express 项目, npm run dev 运行时报错:

Vue express项目npm run dev报错:ESlint Missing的解决方法 经验总结 第1张

详细报错内容如下:

 WARNING  Compiled with 3 warnings                                                                                                                                                                                                                               22:30:22

  ✘  http://eslint.org/docs/rules/comma-dangle  Unexpected trailing comma
  src\components\HelloWorld.vue:92:15
        data: [],
                 ^
✘ 1 problem (1 error, 0 warnings)

Errors:
  1  http://eslint.org/docs/rules/comma-dangle

  ✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\App.vue:11:10
    mounted(){
            ^
  ✘  http://eslint.org/docs/rules/space-before-blocks          Missing space before opening brace
  src\App.vue:11:12
    mounted(){
              ^
  ✘  http://eslint.org/docs/rules/quotes                       Strings must use singlequote
  src\App.vue:12:20
      this.axios.get("api/list").then((res)=>{
                      ^
  ✘  http://eslint.org/docs/rules/arrow-spacing                Missing space before =>
  src\App.vue:12:41
      this.axios.get("api/list").then((res)=>{
                                           ^
  ✘  http://eslint.org/docs/rules/arrow-spacing                Missing space after =>
  src\App.vue:12:44
      this.axios.get("api/list").then((res)=>{
                                              ^
  ✘  http://eslint.org/docs/rules/semi                         Extra semicolon
  src\App.vue:13:23
        console.log(res);
                         ^
✘ 6 problems (6 errors, 0 warnings)

Errors:
  2  http://eslint.org/docs/rules/arrow-spacing
  1  http://eslint.org/docs/rules/space-before-function-paren
  1  http://eslint.org/docs/rules/space-before-blocks
  1  http://eslint.org/docs/rules/quotes
  1  http://eslint.org/docs/rules/semi

  ✘  https://google.com/#q=import%2Ffirst  Import in body of module; reorder to top
  src\main.js:9:1
  import axios from 'axios';
   ^
  ✘  http://eslint.org/docs/rules/semi     Extra semicolon
  src\main.js:9:26
  import axios from 'axios';
                            ^
  ✘  http://eslint.org/docs/rules/semi     Extra semicolon
  src\main.js:10:28
  Vue.prototype.axios = axios;
                              ^
✘ 3 problems (3 errors, 0 warnings)

Errors:
  2  http://eslint.org/docs/rules/semi
  1  https://google.com/#q=import%2Ffirst

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.

解决方法:

找到项目 config 文件夹下的 index.js 文件,将 useEslint 的值修改为 false 即可:

Vue express项目npm run dev报错:ESlint Missing的解决方法 经验总结 第2张

推荐阅读:

JavaScript的引入方式和基本属性

给网站添加熊掌号粉丝关注按钮

判断网页是通过PC端还是移动终端打开的

QQ聊天插件,鼠标划入划出显示隐藏效果。

WebStorm绑定Chrome浏览器实现实时自动刷新

赞 (0)
分享到: +

评论 沙发

Avatar

换个身份

  • 昵称 (必填)
  • 邮箱 (选填)