VS code 代码自动格式化2

 1 {
 2 "workbench.iconTheme": "vscode-icons",
 3 // vscode默认启用了根据文件类型自动设置tabsize的选项
 4 "editor.detectIndentation": false,
 5 // 重新设定tabsize
 6 "editor.tabSize": 2,
 7 // #每次保存的时候自动格式化
 8 "editor.formatOnSave": true,
 9 // #每次保存的时候将代码按eslint格式进行修复
10 "eslint.autoFixOnSave": true,
11 "eslint.alwaysShowStatus": true,
12 "diffEditor.ignoreTrimWhitespace": false,
13 // 添加 vue 支持
14 "eslint.validate": [
15 "javascript",
16 "javascriptreact",
17 {
18 "language": "html",
19 "autoFix": true
20 },
21 {
22 "language": "vue",
23 "autoFix": true
24 },
25 "html",
26 "vue"
27 ],
28 "files.associations": {
29 "*.vue": "vue"
30 },
31 "eslint.options": {
32 //这里为你项目中配置的.eslintrc.js文件,这样保存时效验的规则就和项目一致了,只需轻轻一按 ctrl+s 完美格式化,麻麻再也不用担心我的格式了
33 "configFile": "E:/sixi-pro/DJL/OA/OAUI3/.eslintrc.js"
34 },
35 // #让prettier使用eslint的代码格式进行校验
36 "prettier.eslintIntegration": true,
37 // #去掉代码结尾的分号
38 "prettier.semi": false,
39 // #使用带引号替代双引号
40 "prettier.singleQuote": true,
41 // #让函数(名)和后面的括号之间加个空格
42 "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
43 // #这个按用户自身习惯选择
44 "vetur.format.defaultFormatter.html": "js-beautify-html",
45 // #让vue中的js按编辑器自带的ts格式进行格式化
46 "vetur.format.defaultFormatter.js": "vscode-typescript",
47 "vetur.format.defaultFormatterOptions": {
48 "js-beautify-html": {
49 "wrap_attributes": "force-aligned"
50 // #vue组件中html代码格式化样式
51 }
52 },
53 // 格式化stylus, 需安装Manta's Stylus Supremacy插件
54 "stylusSupremacy.insertColons": false, // 是否插入冒号
55 "stylusSupremacy.insertSemicolons": false, // 是否插入分好
56 "stylusSupremacy.insertBraces": false, // 是否插入大括号
57 "stylusSupremacy.insertNewLineAroundImports": false, // import之后是否换行
58 "stylusSupremacy.insertNewLineAroundBlocks": false // 两个选择器中是否换行
59 }

 

posted @ 2022-05-26 16:50  半世晨曦昏晓  阅读(150)  评论(0编辑  收藏  举报