chore: add encoding config to prevent Chinese garbled text (.editorconfig, .gitattributes)

This commit is contained in:
2025-11-16 15:42:18 +08:00
parent 39eb62ee79
commit 8a17dc80ae
2 changed files with 70 additions and 0 deletions

33
.editorconfig Normal file
View File

@@ -0,0 +1,33 @@
# EditorConfig is awesome: https://EditorConfig.org
# 顶级配置文件
root = true
# 所有文件的默认设置
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# TypeScript/JavaScript 文件
[*.{ts,tsx,js,jsx}]
indent_style = space
indent_size = 2
# JSON 文件
[*.json]
indent_style = space
indent_size = 2
# Markdown 文件(不删除行尾空格,因为两个空格代表换行)
[*.md]
trim_trailing_whitespace = false
# YAML 文件
[*.{yml,yaml}]
indent_style = space
indent_size = 2

37
.gitattributes vendored Normal file
View File

@@ -0,0 +1,37 @@
# 设置默认行为,防止自动转换导致问题
* text=auto
# TypeScript/JavaScript 文件
*.ts text eol=lf
*.tsx text eol=lf
*.js text eol=lf
*.jsx text eol=lf
*.json text eol=lf
# 配置文件
*.yaml text eol=lf
*.yml text eol=lf
.editorconfig text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
# Markdown 文档
*.md text eol=lf
# Shell 脚本
*.sh text eol=lf
# Windows 脚本
*.bat text eol=crlf
*.ps1 text eol=crlf
# 二进制文件
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.pdf binary