1 { 2 // vscode默认启用了根据文件类型自动设置tabsize的选项 3 "editor.detectIndentation": false, 4 // 重新设定tabsize 5 "editor.tabSize": 2, 6 // #每次保存的时候自动格式化 7 "editor.formatOnSave": true, 8 // #每次保存的时候将代码按eslint格式进行修复 9 "eslint.autoFixOnSave": true, 10 // 添加 vue 支持 11 "eslint.validate": [ 12 "javascript", 13 "javascriptreact", 14 { 15 "language": "vue", 16 "autoFix": true 17 } 18 ], 19 // #让prettier使用eslint的代码格式进行校验 20 "prettier.eslintIntegration": true, 21 // #去掉代码结尾的分号 22 "prettier.semi": false, 23 // #使用带引号替代双引号 24 "prettier.singleQuote": true, 25 // #让函数(名)和后面的括号之间加个空格 26 "javascript.format.insertSpaceBeforeFunctionParenthesis": true, 27 // #这个按用户自身习惯选择 28 // "vetur.format.defaultFormatter.html": "js-beautify-html", 29 // #让vue中的js按编辑器自带的ts格式进行格式化 30 "vetur.format.defaultFormatter.js": "vscode-typescript", 31 "vetur.format.defaultFormatterOptions": { 32 "js-beautify-html": { 33 "wrap_attributes": "force-aligned" 34 // #vue组件中html代码格式化样式 35 } 36 }, 37 // 格式化stylus, 需安装Manta's Stylus Supremacy插件 38 "stylusSupremacy.insertColons": false, // 是否插入冒号 39 "stylusSupremacy.insertSemicolons": false, // 是否插入分好 40 "stylusSupremacy.insertBraces": false, // 是否插入大括号 41 "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行 42 "stylusSupremacy.insertNewLineAroundBlocks": false, 43 "editor.codeActionsOnSave": { 44 "source.fixAll.eslint": true 45 } // 两个选择器中是否换行 46 }