【vscode配置】eslint與默認格式化衝突

擴展

  • eslint
  • vetur
  • prettier-code formator

setting.json

{
	"editor.tabSize": 2,
    "editor.formatOnSave": false,
    "editor.formatOnPaste": true,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "prettier.eslintIntegration": true, //讓prettier使用eslint的代碼格式進行校驗
    "prettier.semi": false, //去掉代碼結尾的分號
    "prettier.singleQuote": true, //使用帶引號替代雙引號
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true, //讓函數(名)和後面的括號之間加個空格
    "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" //屬性強制折行對齊
        }
    },
    "eslint.validate": [
        "javascript",
        "html",
        "vue"
    ],
    "files.autoSave": "onWindowChange",
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章