-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path.editorconfig
More file actions
258 lines (221 loc) · 8.93 KB
/
.editorconfig
File metadata and controls
258 lines (221 loc) · 8.93 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# -------------------------------------------------------------------
# Common Editor Config
# Repository : https://github.com/jonas-merkle/Common-Editor-Config
# Author : Jonas Merkle
# License : GNU Lesser General Public License v3.0 (LGPLv3)
# Versioning : Semantic Versioning (SemVer) via Git tags
# Version : v1.0.0
# Description: Cross-language editor style configuration.
# © 2025 Jonas Merkle. Licensed under the LGPLv3.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Root EditorConfig
# -------------------------------------------------------------------
root = true
# -------------------------------------------------------------------
# GLOBAL DEFAULTS (apply to all files unless overridden below)
# -------------------------------------------------------------------
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Use spaces by default; override where tabs are required (e.g. Makefiles)
indent_style = space
indent_size = 4
tab_width = 4
# Not an official core property, but widely respected by many tools.
# Use 'off' for prose-heavy formats where hard-wrapping is unhelpful.
max_line_length = 100
# -------------------------------------------------------------------
# TEXT & DOCS
# -------------------------------------------------------------------
[*.{md,mdx,txt,adoc,rst}]
indent_style = space
indent_size = 2
# Trailing spaces at line ends are meaningful in Markdown for hard line breaks
trim_trailing_whitespace = false
max_line_length = off
# -------------------------------------------------------------------
# MARKUP (HTML, XML) & STYLES (CSS, SCSS)
# -------------------------------------------------------------------
[*.{html,htm,xml,xaml,vue}]
indent_style = space
indent_size = 2
[*.{css,scss,less}]
indent_style = space
indent_size = 2
# -------------------------------------------------------------------
# JAVASCRIPT / TYPESCRIPT
# (Core formatting via EditorConfig; lint/format specifics typically come from ESLint/Prettier)
# -------------------------------------------------------------------
[*.{js,mjs,cjs,jsx}]
indent_style = space
indent_size = 2
max_line_length = 100
[*.{ts,tsx,cts,mts}]
indent_style = space
indent_size = 2
max_line_length = 100
# JSON & JSON with Comments (VS Code, etc.)
[*.{json,jsonc}]
indent_style = space
indent_size = 2
# Keep whitespace strict in data files
trim_trailing_whitespace = true
insert_final_newline = true
# -------------------------------------------------------------------
# YAML / TOML / INI
# -------------------------------------------------------------------
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[*.{toml,ini}]
indent_style = space
indent_size = 2
# -------------------------------------------------------------------
# CSV / TSV / DATA
# -------------------------------------------------------------------
[*.{csv,tsv}]
# Keep trailing whitespace (sometimes significant for empty columns)
trim_trailing_whitespace = false
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
# -------------------------------------------------------------------
# C / C++
# (Detailed code style usually comes from .clang-format; here we set editor basics.)
# -------------------------------------------------------------------
[*.{c,cc,cpp,cxx,h,hpp,hxx,ixx}]
indent_style = space
indent_size = 4
tab_width = 4
# Keep preprocessor columns neat; editors will still respect spaces
trim_trailing_whitespace = true
max_line_length = 100
# -------------------------------------------------------------------
# C#
# Includes Roslyn/.NET code-style options supported in .editorconfig
# Severity levels: suggestion, warning, error (tune to your preference)
# -------------------------------------------------------------------
[*.cs]
indent_style = space
indent_size = 4
tab_width = 4
max_line_length = 100
# usings
dotnet_sort_system_directives_first = true:suggestion
dotnet_separate_import_directive_groups = true:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# var preferences
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion
# expression-bodied members
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
# pattern matching & modern features
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
# nullability & coalescing
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_conditional_expression_over_assignment = true:suggestion
csharp_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# braces, newlines, and layout
csharp_prefer_braces = true:warning
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# modifiers & accessibility
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# using directives placement (outside namespace is common in modern .NET)
csharp_using_directive_placement = outside_namespace:suggestion
# file-scoped namespaces
csharp_style_namespace_declarations = file_scoped:suggestion
# prefer 'new()' target-typed
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
# analyzers: common hygiene
dotnet_diagnostic.IDE0005.severity = warning # Remove unnecessary usings
dotnet_diagnostic.IDE0060.severity = suggestion # Remove unused parameter
dotnet_diagnostic.IDE0044.severity = suggestion # Make field readonly
dotnet_diagnostic.IDE0051.severity = suggestion # Remove unused private members
dotnet_diagnostic.IDE0090.severity = suggestion # 'new()' with target-typed
# -------------------------------------------------------------------
# LaTeX (TeX/LaTeX/BibTeX)
# Trailing spaces can be meaningful (line breaks with two spaces), so keep them.
# -------------------------------------------------------------------
[*.{tex,sty,cls,bib,latex}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
max_line_length = off
# -------------------------------------------------------------------
# SHELL / SCRIPTS / MAKE
# -------------------------------------------------------------------
[*.{sh,bash,zsh}]
indent_style = space
indent_size = 2
# Makefiles require tabs
[Makefile]
indent_style = tab
tab_width = 8
# -------------------------------------------------------------------
# PROJECT / SOLUTION / MSBUILD & XML-LIKE
# -------------------------------------------------------------------
[*.{sln,props,targets,csproj,vcxproj,nuspec,resx,config}]
indent_style = space
indent_size = 2
# -------------------------------------------------------------------
# PYTHON (if present in repo)
# -------------------------------------------------------------------
[*.py]
indent_style = space
indent_size = 4
max_line_length = 100
# -------------------------------------------------------------------
# BATCH / POWERSHELL (Windows scripting)
# -------------------------------------------------------------------
[*.{bat,cmd}]
end_of_line = crlf
[*.ps1]
indent_style = space
indent_size = 2
# -------------------------------------------------------------------
# GIT & DOTFILES
# -------------------------------------------------------------------
[*.{gitattributes,gitignore,gitmodules}]
indent_style = space
indent_size = 2
# -------------------------------------------------------------------
# MISC: SVG (XML), SQL, CSV variants, lockfiles
# -------------------------------------------------------------------
[*.svg]
indent_style = space
indent_size = 2
[*.sql]
indent_style = space
indent_size = 2
max_line_length = off
# Common lockfiles prefer 2 spaces and no trimming surprises
[*.{lock,lockb,package-lock.json,pnpm-lock.yaml,yarn.lock}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
insert_final_newline = true