欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解Vue取消eslint語法限制

 更新時間:2018年08月04日 16:21:29   作者:我是康小小  
本篇文章給大家分享了Vue取消eslint語法限制的相關(guān)知識點內(nèi)容,有興趣的朋友們可以參考學(xué)習(xí)下。

由于vue對語法的限制過于嚴(yán)格,以至于在我第一次編譯運(yùn)行的時候一直編譯失敗,當(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)然,這里的警告我是知道怎么回事,但是這個錯誤我就很不明白了,原來eslint是一個語法檢查工具,但是限制很嚴(yán)格,在我的vue文件里面很多空格都會導(dǎo)致紅線(紅線可以關(guān)閉提示),雖然可以關(guān)閉,但是在編譯的時候老是會跳出來,所以能關(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 導(dǎo)航內(nèi)容設(shè)置選中狀態(tài)樣式的例子

    vue 導(dǎo)航內(nèi)容設(shè)置選中狀態(tài)樣式的例子

    今天小編就為大家分享一篇vue 導(dǎo)航內(nèi)容設(shè)置選中狀態(tài)樣式的例子,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • Vue項目的網(wǎng)絡(luò)請求代理到封裝步驟詳解

    Vue項目的網(wǎng)絡(luò)請求代理到封裝步驟詳解

    這篇文章主要介紹了Vue項目的網(wǎng)絡(luò)請求代理到封裝步驟,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-04-04
  • vue實現(xiàn)的請求服務(wù)器端API接口示例

    vue實現(xiàn)的請求服務(wù)器端API接口示例

    這篇文章主要介紹了vue實現(xiàn)的請求服務(wù)器端API接口,結(jié)合實例形式分析了vue針對post、get、patch、put等請求的封裝與調(diào)用相關(guān)操作技巧,需要的朋友可以參考下
    2019-05-05
  • vue 項目中的this.$get,this.$post等$的用法案例詳解

    vue 項目中的this.$get,this.$post等$的用法案例詳解

    vue.js的插件應(yīng)該暴露一個install方法。這個方法的第一個參數(shù)是vue構(gòu)造器,第二個參數(shù)是一個可選的選項對象,首頁要安裝axios,本文結(jié)合案例代碼給大家詳細(xì)講解vue 中的this.$get,this.$post等$的用法,一起學(xué)習(xí)下吧
    2022-12-12
  • 淺談在不使用ssr的情況下解決Vue單頁面SEO問題(2)

    淺談在不使用ssr的情況下解決Vue單頁面SEO問題(2)

    這篇文章主要介紹了淺談在不使用ssr的情況下解決Vue單頁面SEO問題(2),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-11-11
  • vue的@change的用法及操作代碼

    vue的@change的用法及操作代碼

    @change 是 Vue.js 中用于監(jiān)聽表單元素值變化的事件處理器,這篇文章主要介紹了vue的@change的用法,需要的朋友可以參考下
    2023-10-10
  • Props傳參v-for后TS報錯對象類型是unknow的解決方案

    Props傳參v-for后TS報錯對象類型是unknow的解決方案

    這篇文章主要介紹了Props傳參v-for后TS報錯對象類型是unknow的解決方案,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧
    2024-03-03
  • vue中路由的前進(jìn)和后退問題

    vue中路由的前進(jìn)和后退問題

    這篇文章主要介紹了vue中路由的前進(jìn)和后退問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • vuex的module模塊用法示例

    vuex的module模塊用法示例

    這篇文章主要介紹了vuex的module模塊用法示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-11-11
  • Vue預(yù)渲染:prerender-spa-plugin生成靜態(tài)HTML與vue-meta-info更新meta

    Vue預(yù)渲染:prerender-spa-plugin生成靜態(tài)HTML與vue-meta-info更新meta

    Vue.js中,prerender-spa-plugin和vue-meta-info插件的結(jié)合使用,提供了解決SEO問題的方案,prerender-spa-plugin通過預(yù)渲染技術(shù)生成靜態(tài)HTML,而vue-meta-info則能動態(tài)管理頁面元數(shù)據(jù),本文將探討如何使用這兩個工具優(yōu)化Vue.js項目的SEO表現(xiàn),包括安裝、配置及注意事項
    2024-10-10

最新評論