按照课程所说一步步更改配置项,可是最后一直报错,好像是eslint的问题

按照课程所说一步步更改配置项,可是最后一直报错,好像是eslint的问题

95% emitting WARNING  Compiled with 3 warnings18:47:09                                                                                                                                                                                           ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\main.js:3:22                                                                import Vue from 'vue'                                                                                 ^                                                                                                                                         ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\main.js:4:24                                                                import App from './App'                                                                                 ^                                                                                                                                       ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\main.js:5:30                                                                import router from './router'                                                                                 ^                                                                                                                                 ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\main.js:7:33                                                                Vue.config.productionTip = false                                                                                 ^                                                                                                                              ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\main.js:14:3                                                                })                                                                                 ^                                                                                                                                                                                                                                          ✘ 5 problems (5 errors, 0 warnings)                                                                                                                                                                                                             Errors:                                                                           5  http://eslint.org/docs/rules/semi                                                                                                                                                                                                            ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\router\index.js:1:22                                                        import Vue from 'vue'                                                                                 ^                                                                                                                                         ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\router\index.js:2:32                                                        import Router from 'vue-router'                                                                                 ^                                                                                                                               ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\router\index.js:4:16                                                        Vue.use(Router)                                                                                 ^                                                                                                                                               ✘  http://eslint.org/docs/rules/semi  Missing semicolon                         src\router\index.js:8:3                                                         })                                                                                 ^                                                                                                                                                                                                                                          ✘ 4 problems (4 errors, 0 warnings)                                                                                                                                                                                                             Errors:                                                                           4  http://eslint.org/docs/rules/semi                                                                                                                                                                                                            ✘  https://google.com/#q=vue%2Fscript-indent  Expected indentation of 2 spaces but found 0 spaces                                                               src\App.vue:8:1                                                                 export default {                                                                 ^                                                                                                                                                              ✘  https://google.com/#q=vue%2Fscript-indent  Expected indentation of 4 spaces but found 2 spaces                                                               src\App.vue:9:1                                                                   name: 'App'                                                                    ^                                                                                                                                                              ✘  https://google.com/#q=vue%2Fscript-indent  Expected indentation of 2 spaces but found 0 spaces                                                               src\App.vue:10:1                                                                }                                                                                ^                                                                                                                                                              ✘  http://eslint.org/docs/rules/semi          Missing semicolon                                                                                                 src\App.vue:10:2                                                                }                                                                                 ^                                                                                                                                                                                                                                           ✘ 4 problems (4 errors, 0 warnings)                                                                                                                                                                                                             Errors:                                                                           3  https://google.com/#q=vue%2Fscript-indent                                    1  http://eslint.org/docs/rules/semi                                                                                                                          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.                                                                                                      

这种要怎么解决呢

正在回答

登陆购买课程后可参与讨论,去登陆

3回答

同学你好,这些不是报错信息,是由于ESlint检测语法不规范导致的警告信息,不影响程序的运行。

同学如果想要去除这些警告信息,可以找到build下的webpack.base.conf.js文件,将如下代码注释即可

http://img1.sycdn.imooc.com//climg/5dea364a098e39c607330370.jpg

注释上图的代码保存文件之后, 需要重启项目才会生效, 同学可以清除浏览器缓存,然后,使用npm run dev 命令重启项目

如果帮助到了你, 欢迎采纳,祝学习愉快~~~

  • 慕用0863198 提问者 #1
    可是我使用npm run lint --fix之后还是进行报错啊
    2019-12-06 19:09:38
好帮手慕慕子 2019-12-07 18:01:43

同学你好, npm run lint --fix确实是可以修正代码的语法规范。但是,不清楚同学说的报错信息具体是指什么,也有可能是因为代码中存在错误,导致了报错,所以无法准确的定位问题所在。

因为eslint语法检测不影响我们项目的正常运行,所以可以直接参考第一条回复中的截图,将语法检测关闭,继续往后学习, 将重点放在与vue相关知识的学习上

建议:可以新建提问,详细描述一下具体报了什么错,便于帮助同学准确的定位与解决问题。

如果帮助到了你,欢迎采纳,祝学习愉快~

好帮手慕慕子 2019-12-07 09:51:28

同学你好, 建议:按照老师上一条回复中的步骤操作,找到build文件夹下的webpack.base.conf.js文件,将截图中圈起来的代码注释,关闭eslint语法检查。 保存文件之后, 重新执行npm run dev启动项目,就不会在出现与eslint语法相关的警告信息了。

对于同学说的使用 npm run lint --fix之后还是报错,具体报的什么错呢,可以新建提问, 将你写的代码和报错信息都粘贴过来,便于帮助同学准确的定位与解决问题

如果帮助到了你,欢迎采纳,祝学习愉快~

  • 提问者 慕用0863198 #1
    是这样,我的意思是使用lint --fix不是可以按照规则把不正确的规范改过来嘛,使用之后应该是把代码规范改过来的状态了,那为什么还会报错呢
    2019-12-07 09:54:06
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
热门框架Vue开发WebApp 18版
  • 参与学习           人
  • 提交作业       209    份
  • 解答问题       3299    个

本路径是通过ES6基础知识、运用Zepto、Swiper、fullPag等移动端常用工具包、以及当下流行框架Vue,结合多个实战案例,还原真实开发场景,最终实现手机端购物商城网页开发。

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师