鍍金池/ 問答/HTML/ VSCode eslint 按 airbnb 規(guī)范驗(yàn)證 vue 出現(xiàn)問題

VSCode eslint 按 airbnb 規(guī)范驗(yàn)證 vue 出現(xiàn)問題

VSCode Version 1.20.0

Setting

    "eslint.autoFixOnSave": true,
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        "vue"
    ],
    "eslint.options": {
        "plugins": [
            "html"
        ]
    },
    "eslint.alwaysShowStatus": true,

.eslintrc.js

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint'
  },
  env: {
    browser: true,
  },
  // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
  // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
  extends: ['plugin:vue/essential', 'airbnb-base'],
  // required to lint *.vue files
  plugins: [
    'vue'
  ],
  // chec

配置完成后 js 文件可以正常驗(yàn)證 airbnb 規(guī)范
image
但 vue 文件只能驗(yàn)證部分規(guī)范
image
image
但像 Missing semicolon 這樣的規(guī)范就無法識(shí)別
image

但運(yùn)行npm run dev 是可以識(shí)別
image

這讓我很迷茫,到底問題是出在哪,求大神幫忙,網(wǎng)上能找的配置已經(jīng)都試過了,都無法解決

回答
編輯回答
鹿惑

找到問題了

"eslint.validate": [
    "javascript",
    "javascriptreact",
    "html",
    "vue"
],
"eslint.options": {
// 不要這個(gè),添加之后只識(shí)別.html文件 不會(huì)去識(shí)別.vue
//    "plugins": [
//        "html"
//    ]
},

這個(gè)問題找了我4個(gè)小時(shí)??! 終于解決了

2018年8月11日 07:21