.editorconfig todo
文档用途
介绍 .editorconfig 以及实践中的注意事项.
简介
INFO
参考官方网站 editorconfig.org.
.editorconfig 用于在项目中定义和维护一致的代码风格.
它可以帮助开发团队确保在不同的编辑器和 IDE 中使用相同的代码风格规范.
示例
txt
# 针对所有文件
[*]
# 缩进风格
indent_style = space
# 换行符风格
end_of_line = lf
# 选用 utf-8 字符集
charset = utf-8
# 为文件结尾插入空行
insert_final_newline = false
# 删除行尾的空格
trim_trailing_whitespace = true
## 针对 .yml 和 .yaml 文件
[*.{yml,yaml}]
indent_size = 2
tab_width = 2root
.editorconfig 在工程中可以存在多个, 位于不同的路径下.
配置项 root=true 用于指示编辑器在查找 .editorconfig 文件时, 应停止向上级目录查找.
这样可以确保不同子目录可以有不同的代码风格配置, 而不会受到上层目录的影响.
txt
root=true
[*]
indent_style = space
end_of_line = lf