ESlint 檢查項及其解決辦法

1.錯誤提示

 ✘  http://eslint.org/docs/rules/no-trailing-spaces  Trailing spaces not allowed
  src\App.vue:2:17
    <div id="app">

 方案1.這句的意思是 在<div id="app">這行代碼後面存在空格,去掉空格


方案2,調整規則,但是目前規則(ESLint 0.7.1.)設定里只有註釋行和空白行設定允許空格
參考 https://eslint.org/docs/rules/no-trailing-spaces#disallow-trailing-whitespace-at-the-end-of-lines-no-trailing-spaces
項目下.eslintrc.js文件 rules節點下設定
// ignoreComments 允许注释尾随空格,skipBlankLines允许 空行空格
'no-trailing-spaces':["error", { "ignoreComments": true ,"skipBlankLines":true}],

2.錯誤提示:

 ✘  http://eslint.org/docs/rules/eol-last  Newline required at end of file but not found
  src\components\second.vue:17:10
  </script>

方案:這句話的意思是 在文件結尾需要有一個空行

3.錯誤提示

  ✘  http://eslint.org/docs/rules/key-spacing  Missing space before value for key 'path'
  src\router\index.js:16:12
        path:'/',

方案:這句話的意思是說在在值('/')和關鍵字(path)之間缺少空格

猜你喜欢

转载自blog.csdn.net/losedguest/article/details/84790541
今日推荐