Skip to content

Commit cc58f23

Browse files
committed
"chore: add robust .gitattributes + .editorconfig (cross-platform)".
Signed-off-by: https://github.com/Someshdiwan <[email protected]>
1 parent d68186c commit cc58f23

File tree

2 files changed

+189
-0
lines changed

2 files changed

+189
-0
lines changed

.editorconfig

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Top-level EditorConfig
2+
root = true
3+
4+
# ----------------------------------------------------------------------
5+
# Defaults for all files
6+
# ----------------------------------------------------------------------
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
# Keep Markdown trailing spaces (they may mean line breaks)
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
# Java / Kotlin / Gradle (4 spaces)
18+
[*.{java,kt,gradle}]
19+
indent_style = space
20+
indent_size = 4
21+
22+
# Python (4 spaces)
23+
[*.py]
24+
indent_style = space
25+
indent_size = 4
26+
27+
# JavaScript / TypeScript / JSX / TSX (2 spaces)
28+
[*.{js,jsx,ts,tsx}]
29+
indent_style = space
30+
indent_size = 2
31+
32+
# JSON (2 spaces)
33+
[*.json]
34+
indent_style = space
35+
indent_size = 2
36+
37+
# YAML (2 spaces)
38+
[*.{yml,yaml}]
39+
indent_style = space
40+
indent_size = 2
41+
42+
# XML (2 spaces)
43+
[*.xml]
44+
indent_style = space
45+
indent_size = 2
46+
47+
# Shell scripts (2 spaces)
48+
[*.{sh,bash}]
49+
indent_style = space
50+
indent_size = 2
51+
52+
# Windows scripts
53+
[*.{cmd,bat,ps1}]
54+
indent_style = space
55+
indent_size = 2
56+
57+
# Properties files (2 spaces; avoid tabs)
58+
[*.properties]
59+
indent_style = space
60+
indent_size = 2
61+
62+
# Makefiles must use tabs
63+
[Makefile]
64+
indent_style = tab
65+
tab_width = 4

.gitattributes

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# ------------------------------------------------------------------------------
2+
# Core: normalize text files and keep LF in the repo (Windows can still check out
3+
# CRLF locally depending on user config like core.autocrlf)
4+
# ------------------------------------------------------------------------------
5+
* text=auto eol=lf
6+
7+
# ------------------------------------------------------------------------------
8+
# Text files (force LF in repo)
9+
# ------------------------------------------------------------------------------
10+
*.java text eol=lf
11+
*.kt text eol=lf
12+
*.py text eol=lf
13+
*.js text eol=lf
14+
*.jsx text eol=lf
15+
*.ts text eol=lf
16+
*.tsx text eol=lf
17+
*.html text eol=lf
18+
*.css text eol=lf
19+
*.scss text eol=lf
20+
*.md text eol=lf
21+
*.txt text eol=lf
22+
*.xml text eol=lf
23+
*.json text eol=lf
24+
*.yml text eol=lf
25+
*.yaml text eol=lf
26+
*.sh text eol=lf
27+
*.bash text eol=lf
28+
*.gradle text eol=lf
29+
*.properties text eol=lf
30+
*.cmd text eol=lf
31+
*.bat text eol=lf
32+
*.ps1 text eol=lf
33+
34+
# ------------------------------------------------------------------------------
35+
# Binary files (never touch line endings or attempt merges)
36+
# ------------------------------------------------------------------------------
37+
# Images & media
38+
*.png binary
39+
*.jpg binary
40+
*.jpeg binary
41+
*.gif binary
42+
*.ico binary
43+
*.svg binary
44+
*.webp binary
45+
46+
# Documents
47+
*.pdf binary
48+
49+
# Java / native / compiled
50+
*.jar binary
51+
*.war binary
52+
*.class binary
53+
*.dll binary
54+
*.exe binary
55+
*.so binary
56+
*.dylib binary
57+
58+
# Databases & blobs
59+
*.db binary
60+
*.sqlite binary
61+
62+
# Archives & compressed
63+
*.zip binary
64+
*.tar binary
65+
*.tar.gz binary
66+
*.tgz binary
67+
*.7z binary
68+
*.gz binary
69+
*.xz binary
70+
*.bz2 binary
71+
72+
# Animated images / misc
73+
*.gif binary
74+
75+
# ------------------------------------------------------------------------------
76+
# Diff & merge hygiene
77+
# ------------------------------------------------------------------------------
78+
# Treat these as text for nicer diffs (works even without custom drivers)
79+
*.md text
80+
*.json text
81+
*.xml text
82+
83+
# Noise reducers: lockfiles rarely need diffs
84+
package-lock.json -diff
85+
yarn.lock -diff
86+
pnpm-lock.yaml -diff
87+
*.lock -diff
88+
89+
# Merging: don't attempt to merge true binaries
90+
*.jar merge=binary
91+
*.class merge=binary
92+
*.dll merge=binary
93+
*.exe merge=binary
94+
*.so merge=binary
95+
*.dylib merge=binary
96+
*.db merge=binary
97+
*.sqlite merge=binary
98+
*.pdf merge=binary
99+
*.png merge=binary
100+
*.jpg merge=binary
101+
*.jpeg merge=binary
102+
*.gif merge=binary
103+
*.ico merge=binary
104+
*.svg merge=binary
105+
*.webp merge=binary
106+
*.zip merge=binary
107+
*.tar merge=binary
108+
*.tar.gz merge=binary
109+
*.tgz merge=binary
110+
*.7z merge=binary
111+
*.gz merge=binary
112+
*.xz merge=binary
113+
*.bz2 merge=binary
114+
115+
# Lock files: prefer ours to avoid churn
116+
*.lock merge=ours
117+
118+
# ------------------------------------------------------------------------------
119+
# Export settings (exclude dev/meta files from `git archive`)
120+
# ------------------------------------------------------------------------------
121+
.gitattributes export-ignore
122+
.gitignore export-ignore
123+
.github/ export-ignore
124+
tools/ export-ignore

0 commit comments

Comments
 (0)