vscode自动修复eslint

安装eslint,配置

//vscode-eslint
{
    "editor.minimap.enabled": false,
    "svn.default.encoding": "",
    "git.enableSmartCommit": true,
    "cssrem.rootFontSize": 75,
    "diffEditor.ignoreTrimWhitespace": false,
    "zenMode.centerLayout": false,
    "html.format.enable": false,
    "vetur.format.enable": false,
    "vue3snippets.enable-compile-vue-file-on-did-save-code": false,
    "eslint.codeAction.showDocumentation": {
    
        "enable": true
    }
}
//.eslintrc.js
module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  parserOptions: {
    parser: 'babel-eslint'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    eqeqeq: 'off',
    camelcase: 'off',
    '@typescript-eslint/camelcase': 0,
  }
}
//配置完后要清下缓存
rm -rf node_modules/.cache/eslint-loader/
//package.json
"@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/eslint-config-standard": "^5.1.2",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^6.2.2"

第二种配置

//vscode-eslint
{
      "editor.minimap.enabled": false,
      "svn.default.encoding": "",
      "git.enableSmartCommit": true,
      "cssrem.rootFontSize": 75,
      "diffEditor.ignoreTrimWhitespace": false,
      "zenMode.centerLayout": false,
      "html.format.enable": false,
      "vetur.format.enable": false,
      "vue3snippets.enable-compile-vue-file-on-did-save-code": false,
      "eslint.codeAction.showDocumentation": {

      
          "enable": true
  },
  "explorer.confirmDelete": false,
  "eslint.alwaysShowStatus": true,
  "eslint.format.enable": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
  }

推荐阅读更多精彩内容