chore: prettier 继承 .editorconfig 的缩进风格

This commit is contained in:
pany 2024-02-21 13:34:50 +08:00
parent bf9d6eb7b6
commit 34276b5855
3 changed files with 5 additions and 8 deletions

View File

@ -1,3 +1,4 @@
# 修改配置后重启编辑器
# 配置项文档https://editorconfig.org/ # 配置项文档https://editorconfig.org/
# 告知 EditorConfig 插件,当前即是根文件 # 告知 EditorConfig 插件,当前即是根文件
@ -7,9 +8,9 @@ root = true
[*] [*]
## 设置字符集 ## 设置字符集
charset = utf-8 charset = utf-8
## 缩进风格 space | tab建议 space ## 缩进风格 space | tab建议 space(会自动继承给 Prettier
indent_style = space indent_style = space
## 缩进的空格数(修改这里的话需要将 prettier.config.js 和 .vscode -> settings.json 也同步修改 ## 缩进的空格数(会自动继承给 Prettier
indent_size = 2 indent_size = 2
## 换行符类型 lf | cr | crlf一般都是设置为 lf ## 换行符类型 lf | cr | crlf一般都是设置为 lf
end_of_line = lf end_of_line = lf

View File

@ -1,5 +1,4 @@
{ {
"editor.tabSize": 2,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit" "source.fixAll.eslint": "explicit"
}, },

View File

@ -1,4 +1,5 @@
/** /**
* 修改配置后重启编辑器
* 配置项文档https://prettier.io/docs/en/configuration.html * 配置项文档https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config} * @type {import("prettier").Config}
*/ */
@ -6,8 +7,6 @@
export default { export default {
/** 每一行的宽度 */ /** 每一行的宽度 */
printWidth: 120, printWidth: 120,
/** Tab 键的空格数 */
tabWidth: 2,
/** 在对象中的括号之间是否用空格来间隔 */ /** 在对象中的括号之间是否用空格来间隔 */
bracketSpacing: true, bracketSpacing: true,
/** 箭头函数的参数无论有几个,都要括号包裹 */ /** 箭头函数的参数无论有几个,都要括号包裹 */
@ -19,7 +18,5 @@ export default {
/** 对象或者数组的最后一个元素后面不要加逗号 */ /** 对象或者数组的最后一个元素后面不要加逗号 */
trailingComma: "none", trailingComma: "none",
/** 是否加分号 */ /** 是否加分号 */
semi: false, semi: false
/** 是否使用 Tab 格式化 */
useTabs: false
} }