-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.editorconfig
More file actions
110 lines (88 loc) · 2.86 KB
/
.editorconfig
File metadata and controls
110 lines (88 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# =============================================
# EditorConfig 标准配置文件
# 用于统一团队代码风格和编辑器行为
# =============================================
# 根配置文件 - 项目根目录设置此选项后,编辑器会停止在父级目录中查找配置
root = true
# =============================================
# 通用配置 - 适用于所有文件类型
# =============================================
[*]
# 字符编码设置
charset = utf-8
# 缩进设置
indent_style = space # 使用空格进行缩进(替代制表符)
indent_size = 2 # 每个缩进级别使用2个空格
# 行尾设置
end_of_line = lf # 使用 Linux/macOS 风格的 LF 换行符
# 文件格式设置
insert_final_newline = true # 文件末尾自动添加换行符
trim_trailing_whitespace = true # 自动删除行尾空白字符
# 行长度限制(部分编辑器支持)
max_line_length = 100 # 推荐每行不超过100个字符
# =============================================
# 特定文件类型配置
# =============================================
# Markdown 文件配置
[*.md]
# Markdown 中行尾空格有特殊含义(如换行),所以不删除
trim_trailing_whitespace = false
max_line_length = 80 # 文档类文件建议更短的行长度
# Python 文件配置
[*.py]
indent_size = 4 # Python 官方推荐4空格缩进
max_line_length = 79 # PEP8 标准规定最大79字符
# Java/C/C++/C# 文件配置
[*.{java,c,cpp,cc,h,hpp,cs}]
indent_size = 4 # 传统语言通常使用4空格缩进
# 前端文件配置 (JavaScript/TypeScript/JSX/TSX/Vue)
[*.{js,jsx,ts,tsx,vue}]
indent_size = 2 # 前端生态普遍使用2空格缩进
# HTML/XML 文件配置
[*.{html,xml,xhtml}]
indent_size = 2 # 标记语言使用2空格缩进
# CSS/LESS/SCSS 文件配置
[*.{css,less,scss,sass}]
indent_size = 2
# JSON 配置文件
[*.{json,jsonc}]
indent_size = 2
# JSON 文件通常不需要末尾换行符
insert_final_newline = false
# YAML 文件配置
[*.{yml,yaml}]
indent_size = 2 # YAML 对缩进非常敏感
# Shell 脚本配置
[*.sh]
indent_size = 2
# Shell 脚本通常使用制表符缩进,但空格更统一
indent_style = space
# Dockerfile 配置
[Dockerfile]
indent_size = 4
# Git 相关文件
[.gitignore]
indent_size = 2
# =============================================
# 特定目录配置
# =============================================
# 测试文件目录
[**/test/**]
# 测试文件可能允许稍长的行
max_line_length = 120
# 文档目录
[**/docs/**]
max_line_length = 80
trim_trailing_whitespace = false
# 依赖目录(通常不需要格式化)
[**/node_modules/**]
[**/vendor/**]
[**/dist/**]
[**/build/**]
# 忽略这些目录的代码风格检查
charset = unset
indent_style = unset
indent_size = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset