eslint的error:Strings must use singlequote等

原创
2018/11/27 08:55
阅读数 2.5W

eslint的error:Strings must use singlequote等

 WARNING  Compiled with 1 warnings                                                                                                    4:00:42 PM
  ✘  http://eslint.org/docs/rules/spaced-comment  Expected space or tab after '//' in comment  
  src/router/index.js:6:1
  //const subscribeList = r => require.ensure([], () => r(require('../components/subscribeList')), 'subscribeList');
   ^
✘ 1 problem (1 error, 0 warnings)
Errors:
  1  http://eslint.org/docs/rules/spaced-comment
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.  

解决: // const

  ✘  http://eslint.org/docs/rules/no-multiple-empty-lines  More than 1 blank line not allowed              
  src/components/subscribeList.vue:6:1
<script>


</script>

解决:

<script>

</script>
  ✘  https://google.com/#q=vue%2Fvalid-template-root  The template root requires exactly one element  
  src/components/subscribeList.vue:1:1
  <template>
   ^

解决:

<template>
  <div class="main-wrap">
  </div>
</template>
  ✘  http://eslint.org/docs/rules/comma-style  Bad line breaking before and after ','  
  src/router/index.js:19:5
      ,
       ^

解决: },

  ✘  http://eslint.org/docs/rules/semi                 Extra semicolon                                                
  src/main.js:17:32
    let login = getStore('login');

解决: let login = getStore('login')

  ✘  http://eslint.org/docs/rules/no-unneeded-ternary  Unnecessary use of boolean literals in conditional expression  
  src/main.js:18:43
    store.state.login = login === 'false' ? false : true
                                             ^

解决: store.state.login = login !== "false"

  ✘  http://eslint.org/docs/rules/quotes  Strings must use singlequote  
  src/main.js:18:33
    store.state.login = login !== "false"

解决:

store.state.login = login !== 'false'
或者
/* eslint-disable */
或者
.eslintrc.js的rules里:
"quotes": [1, "single"], //引号类型 `` "" ''
error变成waring而已:
✘ 1 problem (0 errors, 1 warning)
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部