今天用 Vue 脚手架 Vue CLI 拉了一个 express 项目, npm run dev
运行时报错:
详细报错内容如下:
代码语言:javascript复制 WARNING Compiled with 3 warnings 22:30:22
✘ http://eslint.org/docs/rules/comma-dangle Unexpected trailing comma
srccomponentsHelloWorld.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
srcApp.vue:11:10
mounted(){
^
✘ http://eslint.org/docs/rules/space-before-blocks Missing space before opening brace
srcApp.vue:11:12
mounted(){
^
✘ http://eslint.org/docs/rules/quotes Strings must use singlequote
srcApp.vue:12:20
this.axios.get("api/list").then((res)=>{
^
✘ http://eslint.org/docs/rules/arrow-spacing Missing space before =>
srcApp.vue:12:41
this.axios.get("api/list").then((res)=>{
^
✘ http://eslint.org/docs/rules/arrow-spacing Missing space after =>
srcApp.vue:12:44
this.axios.get("api/list").then((res)=>{
^
✘ http://eslint.org/docs/rules/semi Extra semicolon
srcApp.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/first Import in body of module; reorder to top
srcmain.js:9:1
import axios from 'axios';
^
✘ http://eslint.org/docs/rules/semi Extra semicolon
srcmain.js:9:26
import axios from 'axios';
^
✘ http://eslint.org/docs/rules/semi Extra semicolon
srcmain.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/first
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
即可:
声明:本文由w3h5原创,转载请注明出处:《Vue express项目npm run dev报错:ESlint Missing的解决方法》 https://cloud.tencent.com/developer/article/1599487
本文已加入 腾讯云自媒体分享计划 (点击加入)