您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)Vue如何取消eslint語(yǔ)法的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。
由于vue對(duì)語(yǔ)法的限制過(guò)于嚴(yán)格,以至于在我第一次編譯運(yùn)行的時(shí)候一直編譯失敗,當(dāng)然也包括一些警告:
? my-project npm run dev > bblee-app@1.0.0 dev /Users/bianlifeng/my-project > webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 95% emitting WARNING Compiled with 1 warnings 5:00:12 PM ? http://eslint.org/docs/rules/indent Expected indentation of 0 spaces but found 2 src/components/Message.vue:46:1 export default { ^ ? http://eslint.org/docs/rules/indent Expected indentation of 2 spaces but found 4 src/components/Message.vue:47:1 data() { ^ ? http://eslint.org/docs/rules/space-before-function-paren Missing space before function parentheses src/components/Message.vue:47:9 data() { ^ ? http://eslint.org/docs/rules/indent Expected indentation of 4 spaces but found 6 src/components/Message.vue:48:1 return { ^ ? http://eslint.org/docs/rules/indent Expected indentation of 6 spaces but found 8 src/components/Message.vue:49:1 form: { ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:50:1 name: '', ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:51:1 region: '', ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:52:1 date1: '', ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:53:1 date2: '', ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:54:1 delivery: false, ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:55:1 type: [], ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:56:1 resource: '', ^ ? http://eslint.org/docs/rules/indent Expected indentation of 8 spaces but found 10 src/components/Message.vue:57:1 desc: '' ^ ? http://eslint.org/docs/rules/indent Expected indentation of 6 spaces but found 8 src/components/Message.vue:58:1 } ^ ? http://eslint.org/docs/rules/indent Expected indentation of 4 spaces but found 6 src/components/Message.vue:59:1 } ^ ? http://eslint.org/docs/rules/indent Expected indentation of 2 spaces but found 4 src/components/Message.vue:60:1 }, ^ ? http://eslint.org/docs/rules/indent Expected indentation of 2 spaces but found 4 src/components/Message.vue:61:1 methods: { ^ ? http://eslint.org/docs/rules/indent Expected indentation of 4 spaces but found 6 src/components/Message.vue:62:1 onSubmit() { ^ ? http://eslint.org/docs/rules/space-before-function-paren Missing space before function parentheses src/components/Message.vue:62:15 onSubmit() { ^ ? http://eslint.org/docs/rules/indent Expected indentation of 6 spaces but found 8 src/components/Message.vue:63:1 console.log('submit!'); ^ ? http://eslint.org/docs/rules/indent Expected indentation of 4 spaces but found 6 src/components/Message.vue:64:1 } ^ ? http://eslint.org/docs/rules/indent Expected indentation of 2 spaces but found 4 src/components/Message.vue:65:1 } ^ ? http://eslint.org/docs/rules/indent Expected indentation of 0 spaces but found 2 src/components/Message.vue:66:1 } ^ ? 23 problems (23 errors, 0 warnings) Errors: 21 http://eslint.org/docs/rules/indent 2 http://eslint.org/docs/rules/space-before-function-paren 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.
當(dāng)然,這里的警告我是知道怎么回事,但是這個(gè)錯(cuò)誤我就很不明白了,原來(lái)eslint是一個(gè)語(yǔ)法檢查工具,但是限制很?chē)?yán)格,在我的vue文件里面很多空格都會(huì)導(dǎo)致紅線(紅線可以關(guān)閉提示),雖然可以關(guān)閉,但是在編譯的時(shí)候老是會(huì)跳出來(lái),所以能關(guān)閉是最好的了。
關(guān)閉方法:
在build/webpack.base.conf.js文件中,注釋或者刪除掉:module->rules中有關(guān)eslint的規(guī)則
module: { rules: [ //...(config.dev.useEslint ? [createLintingRule()] : []), // 注釋或者刪除 { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, ... } ] }
然后重新運(yùn)行一下npm run dev或者構(gòu)建命令 npm run build就可以啦。
感謝各位的閱讀!關(guān)于“Vue如何取消eslint語(yǔ)法”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。