vscode開發vue項目自動整理代碼

安裝必要的插件

 

配置文件

{
  "window.zoomLevel": 0,
  "px-to-rem.px-per-rem": 100,
  "workbench.editor.enablePreview": false, //打開文件不覆蓋
  "search.followSymlinks": false, //關閉快速預覽
  "files.autoSave": "afterDelay", //打開自動保存
  "editor.lineNumbers": "on", //開啓行數提示
  "editor.quickSuggestions": {
    //開啓自動顯示建議
    "other": true,
    "comments": true,
    "strings": true
  },
  "editor.tabSize": 2, //製表符符號eslint
  "editor.formatOnSave": true, //讓prettier使用eslint的代碼格式進行校驗
  "prettier.semi": false, //去掉代碼結尾的分號
  "prettier.singleQuote": false, //使用單引號替代雙引號
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true, //讓函數(名)和後面的括號之間加個空格
  "vetur.validation.template": false, //關閉vetur對template的檢測
  "vetur.format.defaultFormatter.html": "js-beautify-html", //格式化.vue中html
  "vetur.format.defaultFormatter.js": "vscode-typescript", //讓vue中的js按編輯器自帶的ts格式進行格式化
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "force-aligned" //屬性強制折行對齊force-aligned 自動auto
    }
  },
  "eslint.validate": [
    //開啓對.vue文件中錯誤的檢查
    "javascript",
    "javascriptreact",
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "vue",
      "autoFix": true
    }
  ],
  "javascript.updateImportsOnFileMove.enabled": "never",
  "git.enableSmartCommit": true,
  "eslint.autoFixOnSave": true,
  "git.autofetch": true,
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
  "workbench.colorTheme": "Monokai",
  "editor.minimap.enabled": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

 

-------------------------------------------------------------更新---------------------------------------------------------------------------------------------------

setting.json

{
  "window.zoomLevel": 0,
  "px-to-rem.px-per-rem": 100,
  "workbench.editor.enablePreview": false, //打開文件不覆蓋
  "search.followSymlinks": false, //關閉快速預覽
  "files.autoSave": "afterDelay", //打開自動保存
  "editor.lineNumbers": "on", //開啓行數提示
  "editor.quickSuggestions": {
    //開啓自動顯示建議
    "other": true,
    "comments": true,
    "strings": true
  },
  "editor.tabSize": 2, //製表符符號eslint
  "editor.formatOnSave": true, //讓prettier使用eslint的代碼格式進行校驗
  "prettier.semi": false, //去掉代碼結尾的分號
  "prettier.singleQuote": false, //使用單引號替代雙引號
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true, //讓函數(名)和後面的括號之間加個空格
  "vetur.validation.template": false, //關閉vetur對template的檢測
  "vetur.format.defaultFormatter.html": "js-beautify-html", //格式化.vue中html
  "vetur.format.defaultFormatter.js": "vscode-typescript", //讓vue中的js按編輯器自帶的ts格式進行格式化
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "force-aligned" //屬性強制折行對齊force-aligned 自動auto
    }
  },
  "eslint.validate": [
    //開啓對.vue文件中錯誤的檢查
    "javascript",
    "javascriptreact",
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "vue",
      "autoFix": true
    }
  ],
  "javascript.updateImportsOnFileMove.enabled": "never",
  "git.enableSmartCommit": true,
  "eslint.autoFixOnSave": true,
  "git.autofetch": true,
  "[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
  "workbench.iconTheme": "Monokai Pro (Filter Machine) Icons",
  "workbench.colorTheme": "Monokai",
  "editor.minimap.enabled": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章