vscode+eslint+prettier

  1. Installation ESLint

  2. Installation Prettier - Code formatter

  3. Installation vetur

  4. Open the File -> Preferences - "setting, locate and open setting.jsonadd the following configuration:

    {
        "editor.formatOnPaste": true,
        "editor.formatOnSave": true,
        "editor.formatOnType": true,
        "prettier.singleQuote": true,
        "prettier.semi": false,
        "eslint.autoFixOnSave": true
    }
    复制代码
  5. You can customize Eslint configuration:

    {
     "eslint.enable": true, // 是否开启检测
     "editor.tabSize": 2,
     "eslint.autoFixOnSave": true,
     "files.associations": {
     "*.vue": "vue"
     },
     "eslint.options": {
     "extensions": [
      ".js",
      ".vue"
     ]
     },
     "eslint.validate": [
     "javascript",{
      "language": "vue",
      "autoFix": true
     },
     "html",
     "vue"
     ],
    }
    复制代码

Reproduced in: https: //juejin.im/post/5d0b557be51d45777540fdc5

Guess you like

Origin blog.csdn.net/weixin_34192816/article/details/93170056