|
| 1 | +# EditorConfig is awesome: https://EditorConfig.org |
| 2 | + |
| 3 | +# Top-most EditorConfig file |
| 4 | +root = true |
| 5 | + |
| 6 | +# Default settings for all files |
| 7 | +[*] |
| 8 | +indent_style = space |
| 9 | +indent_size = 4 |
| 10 | +end_of_line = lf |
| 11 | +charset = utf-8 |
| 12 | +trim_trailing_whitespace = true |
| 13 | +insert_final_newline = true |
| 14 | + |
| 15 | +# Markdown files |
| 16 | +[*.md] |
| 17 | +trim_trailing_whitespace = false |
| 18 | + |
| 19 | +# JSON/YAML/XML configuration files |
| 20 | +[*.{json,yml,yaml,xml,csproj,props,targets}] |
| 21 | +indent_size = 2 |
| 22 | + |
| 23 | +# C# files |
| 24 | +[*.cs] |
| 25 | +indent_size = 4 |
| 26 | + |
| 27 | +# Organize usings |
| 28 | +dotnet_sort_system_directives_first = true |
| 29 | +dotnet_separate_import_directive_groups = false |
| 30 | + |
| 31 | +# this. preferences |
| 32 | +dotnet_style_qualification_for_field = false:warning |
| 33 | +dotnet_style_qualification_for_property = false:warning |
| 34 | +dotnet_style_qualification_for_method = false:warning |
| 35 | +dotnet_style_qualification_for_event = false:warning |
| 36 | + |
| 37 | +# Language keywords vs BCL types preferences |
| 38 | +dotnet_style_predefined_type_for_locals_parameters_members = true:warning |
| 39 | +dotnet_style_predefined_type_for_member_access = true:warning |
| 40 | + |
| 41 | +# Parentheses preferences |
| 42 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion |
| 43 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion |
| 44 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion |
| 45 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion |
| 46 | + |
| 47 | +# Modifier preferences |
| 48 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning |
| 49 | +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning |
| 50 | + |
| 51 | +# Expression-level preferences |
| 52 | +dotnet_style_object_initializer = true:suggestion |
| 53 | +dotnet_style_collection_initializer = true:suggestion |
| 54 | +dotnet_style_explicit_tuple_names = true:warning |
| 55 | +dotnet_style_null_propagation = true:suggestion |
| 56 | +dotnet_style_coalesce_expression = true:suggestion |
| 57 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning |
| 58 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 59 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 60 | +dotnet_style_prefer_auto_properties = true:suggestion |
| 61 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 62 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 63 | + |
| 64 | +# Field preferences |
| 65 | +dotnet_style_readonly_field = true:warning |
| 66 | + |
| 67 | +# Parameter preferences |
| 68 | +dotnet_code_quality_unused_parameters = all:warning |
| 69 | + |
| 70 | +# Suppression preferences |
| 71 | +dotnet_remove_unnecessary_suppression_exclusions = none |
| 72 | + |
| 73 | +# New line preferences |
| 74 | +dotnet_style_allow_multiple_blank_lines_experimental = false:warning |
| 75 | +dotnet_style_allow_statement_immediately_after_block_experimental = false:warning |
| 76 | + |
| 77 | +# var preferences |
| 78 | +csharp_style_var_for_built_in_types = true:suggestion |
| 79 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 80 | +csharp_style_var_elsewhere = true:suggestion |
| 81 | + |
| 82 | +# Expression-bodied members |
| 83 | +csharp_style_expression_bodied_methods = when_on_single_line:suggestion |
| 84 | +csharp_style_expression_bodied_constructors = when_on_single_line:suggestion |
| 85 | +csharp_style_expression_bodied_operators = when_on_single_line:suggestion |
| 86 | +csharp_style_expression_bodied_properties = true:suggestion |
| 87 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 88 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 89 | +csharp_style_expression_bodied_lambdas = true:suggestion |
| 90 | +csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion |
| 91 | + |
| 92 | +# Pattern matching preferences |
| 93 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 94 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 95 | +csharp_style_prefer_switch_expression = true:suggestion |
| 96 | +csharp_style_prefer_pattern_matching = true:suggestion |
| 97 | +csharp_style_prefer_not_pattern = true:suggestion |
| 98 | + |
| 99 | +# Null-checking preferences |
| 100 | +csharp_style_throw_expression = true:suggestion |
| 101 | +csharp_style_conditional_delegate_call = true:suggestion |
| 102 | + |
| 103 | +# Code-block preferences |
| 104 | +csharp_prefer_braces = true:warning |
| 105 | +csharp_prefer_simple_using_statement = true:suggestion |
| 106 | + |
| 107 | +# Expression preferences |
| 108 | +csharp_prefer_simple_default_expression = true:suggestion |
| 109 | +csharp_style_prefer_local_over_anonymous_function = true:suggestion |
| 110 | +csharp_style_prefer_index_operator = true:suggestion |
| 111 | +csharp_style_prefer_range_operator = true:suggestion |
| 112 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion |
| 113 | +csharp_style_prefer_tuple_swap = true:suggestion |
| 114 | +csharp_style_prefer_utf8_string_literals = true:suggestion |
| 115 | + |
| 116 | +# 'using' directive preferences |
| 117 | +csharp_using_directive_placement = outside_namespace:warning |
| 118 | + |
| 119 | +# Namespace preferences |
| 120 | +csharp_style_namespace_declarations = file_scoped:warning |
| 121 | + |
| 122 | +# New line preferences |
| 123 | +csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning |
| 124 | +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning |
| 125 | +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:warning |
| 126 | + |
| 127 | +# Naming styles |
| 128 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 129 | +dotnet_naming_style.camel_case.capitalization = camel_case |
| 130 | +dotnet_naming_style.underscore_prefix.capitalization = camel_case |
| 131 | +dotnet_naming_style.underscore_prefix.required_prefix = _ |
| 132 | + |
| 133 | +# Naming rules - Interfaces |
| 134 | +dotnet_naming_rule.interfaces_should_be_prefixed_with_i.severity = warning |
| 135 | +dotnet_naming_rule.interfaces_should_be_prefixed_with_i.symbols = interfaces |
| 136 | +dotnet_naming_rule.interfaces_should_be_prefixed_with_i.style = interface_style |
| 137 | +dotnet_naming_symbols.interfaces.applicable_kinds = interface |
| 138 | +dotnet_naming_symbols.interfaces.applicable_accessibilities = * |
| 139 | +dotnet_naming_style.interface_style.required_prefix = I |
| 140 | +dotnet_naming_style.interface_style.capitalization = pascal_case |
| 141 | + |
| 142 | +# Naming rules - Types |
| 143 | +dotnet_naming_rule.types_should_be_pascal_case.severity = warning |
| 144 | +dotnet_naming_rule.types_should_be_pascal_case.symbols = types |
| 145 | +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case |
| 146 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum, delegate |
| 147 | +dotnet_naming_symbols.types.applicable_accessibilities = * |
| 148 | + |
| 149 | +# Naming rules - Non-field members |
| 150 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning |
| 151 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members |
| 152 | +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case |
| 153 | +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method |
| 154 | +dotnet_naming_symbols.non_field_members.applicable_accessibilities = * |
| 155 | + |
| 156 | +# Naming rules - Private fields |
| 157 | +dotnet_naming_rule.private_fields_should_be_underscore_prefix.severity = warning |
| 158 | +dotnet_naming_rule.private_fields_should_be_underscore_prefix.symbols = private_fields |
| 159 | +dotnet_naming_rule.private_fields_should_be_underscore_prefix.style = underscore_prefix |
| 160 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 161 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 162 | + |
| 163 | +# Naming rules - Constants |
| 164 | +dotnet_naming_rule.constants_should_be_pascal_case.severity = warning |
| 165 | +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants |
| 166 | +dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case |
| 167 | +dotnet_naming_symbols.constants.applicable_kinds = field |
| 168 | +dotnet_naming_symbols.constants.required_modifiers = const |
| 169 | + |
| 170 | +# Naming rules - Local variables and parameters |
| 171 | +dotnet_naming_rule.locals_should_be_camel_case.severity = warning |
| 172 | +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals |
| 173 | +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case |
| 174 | +dotnet_naming_symbols.locals.applicable_kinds = parameter, local |
| 175 | + |
| 176 | +# Formatting rules |
| 177 | +csharp_new_line_before_open_brace = all |
| 178 | +csharp_new_line_before_else = true |
| 179 | +csharp_new_line_before_catch = true |
| 180 | +csharp_new_line_before_finally = true |
| 181 | +csharp_new_line_before_members_in_object_initializers = true |
| 182 | +csharp_new_line_before_members_in_anonymous_types = true |
| 183 | +csharp_new_line_between_query_expression_clauses = true |
| 184 | + |
| 185 | +# Indentation preferences |
| 186 | +csharp_indent_case_contents = true |
| 187 | +csharp_indent_switch_labels = true |
| 188 | +csharp_indent_labels = one_less_than_current |
| 189 | +csharp_indent_block_contents = true |
| 190 | +csharp_indent_braces = false |
| 191 | +csharp_indent_case_contents_when_block = false |
| 192 | + |
| 193 | +# Space preferences |
| 194 | +csharp_space_after_cast = false |
| 195 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 196 | +csharp_space_between_parentheses = false |
| 197 | +csharp_space_before_colon_in_inheritance_clause = true |
| 198 | +csharp_space_after_colon_in_inheritance_clause = true |
| 199 | +csharp_space_around_binary_operators = before_and_after |
| 200 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 201 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 202 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 203 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 204 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 205 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 206 | +csharp_space_after_comma = true |
| 207 | +csharp_space_before_comma = false |
| 208 | +csharp_space_after_dot = false |
| 209 | +csharp_space_before_dot = false |
| 210 | +csharp_space_after_semicolon_in_for_statement = true |
| 211 | +csharp_space_before_semicolon_in_for_statement = false |
| 212 | +csharp_space_around_declaration_statements = false |
| 213 | +csharp_space_before_open_square_brackets = false |
| 214 | +csharp_space_between_empty_square_brackets = false |
| 215 | +csharp_space_between_square_brackets = false |
| 216 | + |
| 217 | +# Wrapping preferences |
| 218 | +csharp_preserve_single_line_statements = false |
| 219 | +csharp_preserve_single_line_blocks = true |
| 220 | + |
| 221 | +# Diagnostic IDs to suppress |
| 222 | +# IDE0058: Expression value is never used |
| 223 | +dotnet_diagnostic.IDE0058.severity = none |
| 224 | + |
| 225 | +# JavaScript/TypeScript files (for scripts) |
| 226 | +[*.{js,mjs,ts}] |
| 227 | +indent_size = 2 |
0 commit comments