eslint

157 阅读1分钟
  1. 安装一个插件:eslint

  2. 添加用户设置:文件》首选项》设置>eslint > 打开setting.json文件

{
  "editor.fontSize": 14,
  // "cssrem.rootFontSize": 32,
  "liveServer.settings.donotShowInfoMsg": true,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "files.autoSave": "off",
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "vue-html",
    {
      "language": "vue",
      "autoFix": true
    },
    "html",
    "vue"
  ],
  "eslint.autoFixOnSave": true,
  // 需要 npm install -g eslint-plugin-vue
  "eslint.options": {
    "extensions": [
      ".js",
      ".vue"
    ]
  },
  "explorer.confirmDragAndDrop": false,
  "git.enableSmartCommit": true,
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  "sync.gist": "79eef91b1616b93cfcb3400c1cb79e70",
  "[javascript]": {
    // "editor.defaultFormatter": "HookyQR.beautify"
  },
  "workbench.iconTheme": "material-icon-theme",
  "less.compile": {
    "outExt": ".wxss"
  },
  "emmet.triggerExpansionOnTab": true,
  "emmet.includeLanguages": {
    "vue-html": "html",
    "vue": "html"
  },
  "[css]": {
        
    },
    "files.associations": {
      "*.wxss": "css",
      "*.wxml": "html"
    },
    "git.autofetch": true
}
  1. 重启vs-code