From 6854c8d4706585145439c7f0147dd98cbe854f94 Mon Sep 17 00:00:00 2001 From: Chuckie Chen Date: Sat, 21 Feb 2026 15:38:08 +0800 Subject: [PATCH] feat: add .editorconfig and .gitattributes for consistent file formatting --- template/.editorconfig | 32 ++++++++++++++++++++++++++++++++ template/.gitattributes | 28 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 template/.editorconfig create mode 100644 template/.gitattributes diff --git a/template/.editorconfig b/template/.editorconfig new file mode 100644 index 00000000..46ca6361 --- /dev/null +++ b/template/.editorconfig @@ -0,0 +1,32 @@ + +root = true + +[*.md] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.py] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 +max_line_length = 88 + +[*.{yml,yaml,md,css,html,js,jsx,ts,tsx,json}] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab + +[*.sh] +end_of_line = lf +trim_trailing_whitespace = true + +[*.bat] +end_of_line = crlf +trim_trailing_whitespace = false diff --git a/template/.gitattributes b/template/.gitattributes new file mode 100644 index 00000000..0273e01d --- /dev/null +++ b/template/.gitattributes @@ -0,0 +1,28 @@ +# Auto detect text files and normalize line endings +* text=auto + +# Force LF for specific text files +*.py text eol=lf +*.sh text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.md text eol=lf +*.txt text eol=lf +*.json text eol=lf +Dockerfile text eol=lf + +# Windows scripts keep CRLF +*.ps1 text eol=crlf +*.bat text eol=crlf + +# Binary files +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.zip binary +*.gz binary + +# Ensure shell scripts keep LF and executable permission +*.sh eol=lf