|
| 1 | +# EditorConfig: https://editorconfig.org |
| 2 | +# Root config — stops editors searching parent directories for further .editorconfig files. |
| 3 | +root = true |
| 4 | + |
| 5 | +# ────────────────────────────────────────────── |
| 6 | +# All files |
| 7 | +# ────────────────────────────────────────────── |
| 8 | +[*] |
| 9 | +charset = utf-8 |
| 10 | +end_of_line = lf |
| 11 | +insert_final_newline = true |
| 12 | +trim_trailing_whitespace = true |
| 13 | + |
| 14 | +# ────────────────────────────────────────────── |
| 15 | +# C# source files |
| 16 | +# ────────────────────────────────────────────── |
| 17 | +[*.cs] |
| 18 | +indent_style = space |
| 19 | +indent_size = 4 |
| 20 | + |
| 21 | +# --- Using directives --- |
| 22 | +# Keep using directives outside the namespace block (Java/traditional C# style). |
| 23 | +csharp_using_directive_placement = outside_namespace:suggestion |
| 24 | + |
| 25 | +# --- Namespace declarations --- |
| 26 | +# Use traditional block-scoped namespaces: namespace Foo { } rather than file-scoped. |
| 27 | +csharp_style_namespace_declarations = block_scoped:suggestion |
| 28 | + |
| 29 | +# --- Brace placement --- |
| 30 | +# Allman style: opening brace on its own line after the declaration. |
| 31 | +# Applies to all constructs (types, methods, control flow, etc.). |
| 32 | +csharp_new_line_before_open_brace = all |
| 33 | + |
| 34 | +# --- var usage --- |
| 35 | +# Use var when the type is already obvious from the right-hand side (e.g. new, cast). |
| 36 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 37 | +# Use explicit types everywhere else so the reader does not need to infer them. |
| 38 | +csharp_style_var_elsewhere = false:suggestion |
| 39 | + |
| 40 | +# ────────────────────────────────────────────── |
| 41 | +# Roslyn naming rules — private fields |
| 42 | +# Naming symbols: any private field |
| 43 | +# Style: _camelCase prefix |
| 44 | +# ────────────────────────────────────────────── |
| 45 | + |
| 46 | +dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields |
| 47 | +dotnet_naming_rule.private_fields_should_be_camel_case.style = camel_case_underscore_prefix |
| 48 | +dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion |
| 49 | + |
| 50 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 51 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 52 | +dotnet_naming_symbols.private_fields.required_modifiers = |
| 53 | + |
| 54 | +dotnet_naming_style.camel_case_underscore_prefix.capitalization = camel_case |
| 55 | +dotnet_naming_style.camel_case_underscore_prefix.required_prefix = _ |
| 56 | + |
| 57 | +# ────────────────────────────────────────────── |
| 58 | +# Roslyn naming rules — public members |
| 59 | +# Naming symbols: public/internal/protected members (types, methods, properties, events) |
| 60 | +# Style: PascalCase |
| 61 | +# ────────────────────────────────────────────── |
| 62 | + |
| 63 | +dotnet_naming_rule.public_members_should_be_pascal_case.symbols = public_members |
| 64 | +dotnet_naming_rule.public_members_should_be_pascal_case.style = pascal_case |
| 65 | +dotnet_naming_rule.public_members_should_be_pascal_case.severity = suggestion |
| 66 | + |
| 67 | +dotnet_naming_symbols.public_members.applicable_kinds = class, struct, enum, property, method, event, delegate |
| 68 | +dotnet_naming_symbols.public_members.applicable_accessibilities = public, internal, protected, protected_internal |
| 69 | + |
| 70 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 71 | + |
| 72 | +# ────────────────────────────────────────────── |
| 73 | +# Roslyn naming rules — interfaces |
| 74 | +# Naming symbols: interfaces at any accessibility |
| 75 | +# Style: PascalCase with I prefix |
| 76 | +# ────────────────────────────────────────────── |
| 77 | + |
| 78 | +dotnet_naming_rule.interfaces_should_be_prefixed_with_i.symbols = interfaces |
| 79 | +dotnet_naming_rule.interfaces_should_be_prefixed_with_i.style = i_prefix_pascal_case |
| 80 | +dotnet_naming_rule.interfaces_should_be_prefixed_with_i.severity = suggestion |
| 81 | + |
| 82 | +dotnet_naming_symbols.interfaces.applicable_kinds = interface |
| 83 | +dotnet_naming_symbols.interfaces.applicable_accessibilities = * |
| 84 | + |
| 85 | +dotnet_naming_style.i_prefix_pascal_case.capitalization = pascal_case |
| 86 | +dotnet_naming_style.i_prefix_pascal_case.required_prefix = I |
| 87 | + |
| 88 | +# ────────────────────────────────────────────── |
| 89 | +# XML / MSBuild project files |
| 90 | +# ────────────────────────────────────────────── |
| 91 | +[*.{csproj,props,targets,xml}] |
| 92 | +indent_style = space |
| 93 | +indent_size = 2 |
| 94 | + |
| 95 | +# ────────────────────────────────────────────── |
| 96 | +# JSON and YAML |
| 97 | +# ────────────────────────────────────────────── |
| 98 | +[*.{json,yml,yaml}] |
| 99 | +indent_style = space |
| 100 | +indent_size = 2 |
| 101 | + |
| 102 | +# ────────────────────────────────────────────── |
| 103 | +# Markdown |
| 104 | +# Trailing whitespace is meaningful in some Markdown renderers (two trailing |
| 105 | +# spaces produce a hard line break), but this project follows the convention |
| 106 | +# of trimming it and using blank lines for paragraph breaks instead. |
| 107 | +# ────────────────────────────────────────────── |
| 108 | +[*.md] |
| 109 | +trim_trailing_whitespace = true |
| 110 | +insert_final_newline = true |
| 111 | + |
| 112 | +# ────────────────────────────────────────────── |
| 113 | +# Visual Studio solution files |
| 114 | +# Visual Studio generates solution files with tab indentation; preserve that |
| 115 | +# convention to avoid spurious diffs when the IDE regenerates the file. |
| 116 | +# ────────────────────────────────────────────── |
| 117 | +[*.sln] |
| 118 | +indent_style = tab |
| 119 | + |
| 120 | +# ────────────────────────────────────────────── |
| 121 | +# Windows batch / command scripts |
| 122 | +# Windows tools require CRLF line endings in .cmd/.bat files. |
| 123 | +# ────────────────────────────────────────────── |
| 124 | +[*.{cmd,bat}] |
| 125 | +end_of_line = crlf |
0 commit comments