|
| 1 | +# EditorConfig is awesome: https://EditorConfig.org |
| 2 | + |
| 3 | +# top-most EditorConfig file |
| 4 | +root = true |
| 5 | + |
| 6 | +[*] |
| 7 | +charset = utf-8 |
| 8 | + |
| 9 | +[*.sln] |
| 10 | +indent_style = tab |
| 11 | + |
| 12 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 13 | +indent_size = 2 |
| 14 | +indent_style = space |
| 15 | + |
| 16 | +[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}] |
| 17 | +indent_size = 2 |
| 18 | +indent_style = space |
| 19 | + |
| 20 | +[*.{json}] |
| 21 | +indent_size = 2 |
| 22 | +indent_style = space |
| 23 | + |
| 24 | +[*.{yml,yaml}] |
| 25 | +indent_size = 2 |
| 26 | +indent_style = space |
| 27 | + |
| 28 | +[*.{htm,html,js,ts,tsx,css,scss,less,vue}] |
| 29 | +end_of_line = lf |
| 30 | +insert_final_newline = true |
| 31 | +indent_size = 2 |
| 32 | +indent_style = space |
| 33 | + |
| 34 | +[*.{cs,csx,cake}] |
| 35 | +charset = utf-8-bom |
| 36 | +end_of_line = lf |
| 37 | +insert_final_newline = true |
| 38 | +indent_size = 4 |
| 39 | +indent_style = space |
| 40 | +max_line_length = 120 |
| 41 | +trim_trailing_whitespace = true |
| 42 | + |
| 43 | +# |
| 44 | +# --- .NET code style settings ------------------------------------------------- |
| 45 | +# |
| 46 | + |
| 47 | +# "this." qualifier |
| 48 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#this_and_me |
| 49 | +dotnet_style_qualification_for_field = false:suggestion |
| 50 | +dotnet_style_qualification_for_property = false:suggestion |
| 51 | +dotnet_style_qualification_for_method = false:suggestion |
| 52 | +dotnet_style_qualification_for_event = false:suggestion |
| 53 | + |
| 54 | +# Language keywords instead of framework type names for type references |
| 55 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language_keywords |
| 56 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 57 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 58 | + |
| 59 | +# Modifier preferences |
| 60 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#normalize_modifiers |
| 61 | +dotnet_style_require_accessibility_modifiers = always:warning |
| 62 | +csharp_preferred_modifier_order = csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning |
| 63 | +dotnet_style_readonly_field = true:suggestion |
| 64 | + |
| 65 | +# Expression-level preferences |
| 66 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level |
| 67 | +dotnet_style_object_initializer = true:suggestion |
| 68 | +dotnet_style_collection_initializer = true:suggestion |
| 69 | +dotnet_style_explicit_tuple_names = true:warning |
| 70 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 71 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 72 | +dotnet_style_prefer_auto_properties = true:suggestion |
| 73 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 74 | + |
| 75 | +# Null-checking preferences |
| 76 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking |
| 77 | +dotnet_style_coalesce_expression = true:suggestion |
| 78 | +dotnet_style_null_propagation = true:suggestion |
| 79 | + |
| 80 | +# |
| 81 | +# --- C# code style settings --------------------------------------------------- |
| 82 | +# |
| 83 | + |
| 84 | +# Implicit and explicit types |
| 85 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#implicit-and-explicit-types |
| 86 | +csharp_style_var_for_built_in_types = true:suggestion |
| 87 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 88 | +csharp_style_var_elsewhere = false:suggestion |
| 89 | + |
| 90 | +# Expression-bodied members |
| 91 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_bodied_members |
| 92 | +csharp_style_expression_bodied_methods = true:suggestion |
| 93 | +csharp_style_expression_bodied_constructors = false:suggestion |
| 94 | +csharp_style_expression_bodied_operators = true:suggestion |
| 95 | +csharp_style_expression_bodied_properties = true:suggestion |
| 96 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 97 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 98 | + |
| 99 | +# Pattern matching |
| 100 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_bodied_members |
| 101 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 102 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 103 | + |
| 104 | +# Inlined variable declarations |
| 105 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#inlined_variable_declarations |
| 106 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 107 | + |
| 108 | +# Expression-level preferences |
| 109 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#expression_level_csharp |
| 110 | +csharp_prefer_simple_default_expression = true:suggestion |
| 111 | +csharp_style_deconstructed_variable_declaration = true:suggestion |
| 112 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 113 | + |
| 114 | +# "Null" checking preferences |
| 115 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking_csharp |
| 116 | +csharp_style_throw_expression = true:suggestion |
| 117 | +csharp_style_conditional_delegate_call = false:suggestion |
| 118 | + |
| 119 | +# Code block preferences |
| 120 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#code_block |
| 121 | +csharp_prefer_braces = true:warning |
| 122 | + |
| 123 | +# |
| 124 | +# --- Formatting conventions --------------------------------------------------- |
| 125 | +# |
| 126 | + |
| 127 | +# Organize usings |
| 128 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#usings |
| 129 | +dotnet_sort_system_directives_first = true |
| 130 | + |
| 131 | +# C# formatting settings |
| 132 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#c-formatting-settings |
| 133 | +csharp_new_line_before_open_brace = methods,accessors,properties,control_blocks,types |
| 134 | +csharp_new_line_before_else = true |
| 135 | +csharp_new_line_before_catch = true |
| 136 | +csharp_new_line_before_finally = true |
| 137 | +csharp_new_line_before_members_in_object_initializers = true |
| 138 | +csharp_new_line_before_members_in_anonymous_types = true |
| 139 | +csharp_new_line_between_query_expression_clauses = true |
| 140 | + |
| 141 | +# Indentation options |
| 142 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#indent |
| 143 | +csharp_indent_case_contents = true |
| 144 | +csharp_indent_switch_labels = true |
| 145 | +csharp_indent_labels = flush_left |
| 146 | + |
| 147 | +# Spacing options |
| 148 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#spacing |
| 149 | +csharp_space_after_cast = false |
| 150 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 151 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 152 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 153 | +csharp_space_between_parentheses = false |
| 154 | +csharp_space_before_colon_in_inheritance_clause = true |
| 155 | +csharp_space_after_colon_in_inheritance_clause = true |
| 156 | +csharp_space_around_binary_operators = before_and_after |
| 157 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 158 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 159 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 160 | + |
| 161 | +# Wrapping options |
| 162 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#wrapping |
| 163 | +csharp_preserve_single_line_statements = true |
| 164 | +csharp_preserve_single_line_blocks = true |
| 165 | + |
| 166 | +# Other options |
| 167 | +# https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers |
| 168 | +csharp_indent_block_contents = true |
| 169 | +csharp_indent_braces = false |
| 170 | +csharp_space_after_comma = true |
| 171 | +csharp_space_after_dot = false |
| 172 | +csharp_space_after_semicolon_in_for_statement = true |
| 173 | +csharp_space_around_declaration_statements = do_not_ignore |
| 174 | +csharp_space_before_comma = false |
| 175 | +csharp_space_before_dot = false |
| 176 | +csharp_space_before_semicolon_in_for_statement = false |
| 177 | +csharp_space_before_open_square_brackets = false |
| 178 | +csharp_space_between_empty_square_brackets = false |
| 179 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 180 | +csharp_space_between_square_brackets = false |
| 181 | + |
| 182 | +# |
| 183 | +# --- Naming conventions ------------------------------------------------------- |
| 184 | +# |
| 185 | + |
| 186 | +# |
| 187 | +# Styles definitions: |
| 188 | +# |
| 189 | + |
| 190 | +# base styles |
| 191 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 192 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 193 | + |
| 194 | +# Style: _camelCase |
| 195 | +dotnet_naming_style.prefix_underscore_style.capitalization = camel_case |
| 196 | +dotnet_naming_style.prefix_underscore_style.required_prefix = _ |
| 197 | + |
| 198 | +# Style: IPascalCase |
| 199 | +dotnet_naming_style.prefix_i_style.capitalization = pascal_case |
| 200 | +dotnet_naming_style.prefix_i_style.required_prefix = I |
| 201 | + |
| 202 | +# Style: PascalCaseAsync |
| 203 | +dotnet_naming_style.suffix_async_style.capitalization = pascal_case |
| 204 | +dotnet_naming_style.suffix_async_style.required_suffix = Async |
| 205 | + |
| 206 | +# Style: PascalCaseBase |
| 207 | +dotnet_naming_style.suffix_base_style.capitalization = pascal_case |
| 208 | +dotnet_naming_style.suffix_base_style.required_suffix = Base |
| 209 | + |
| 210 | +# |
| 211 | +# Symbol definitions |
| 212 | +# |
| 213 | + |
| 214 | +# Symbol: const (no matter accessibility) |
| 215 | +dotnet_naming_symbols.constant_field_symbol.applicable_kinds = field |
| 216 | +dotnet_naming_symbols.constant_field_symbol.required_modifiers = const |
| 217 | + |
| 218 | +# Symbol: private field |
| 219 | +dotnet_naming_symbols.private_field_symbol.applicable_kinds = field |
| 220 | +dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private |
| 221 | + |
| 222 | +# Symbol: non-private field |
| 223 | +dotnet_naming_symbols.non_private_field_symbol.applicable_kinds = field |
| 224 | +dotnet_naming_symbols.non_private_field_symbol.applicable_accessibilities = public,internal,friend,protected,protected_internal,protected_friend |
| 225 | + |
| 226 | +# Symbol: abstract class |
| 227 | +dotnet_naming_symbols.abstract_class_symbol.applicable_kinds = class |
| 228 | +dotnet_naming_symbols.abstract_class_symbol.required_modifiers = abstract |
| 229 | + |
| 230 | +# Symbol: async method |
| 231 | +dotnet_naming_symbols.async_method_symbol.applicable_kinds = method |
| 232 | +dotnet_naming_symbols.async_method_symbol.required_modifiers = async |
| 233 | + |
| 234 | +# Symbol: interface |
| 235 | +dotnet_naming_symbols.interface_type_symbol.applicable_kinds = interface |
| 236 | + |
| 237 | +# Symbol: parameter |
| 238 | +dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter |
| 239 | + |
| 240 | +# Symbol: type |
| 241 | +dotnet_naming_symbols.type_symbol.applicable_kinds = class,struct,enum,delegate |
| 242 | + |
| 243 | +# Symbol: member |
| 244 | +dotnet_naming_symbols.member_symbol.applicable_kinds = method,property,event |
| 245 | + |
| 246 | +# |
| 247 | +# Rules definitions |
| 248 | +# |
| 249 | + |
| 250 | +# Rule: constants |
| 251 | +dotnet_naming_rule.constants_must_be_pascal_case.severity = error |
| 252 | +dotnet_naming_rule.constants_must_be_pascal_case.style = pascal_case_style |
| 253 | +dotnet_naming_rule.constants_must_be_pascal_case.symbols = constant_field_symbol |
| 254 | + |
| 255 | +# Rule: private fields |
| 256 | +dotnet_naming_rule.private_fields_must_be_prefixed_with_underscore.severity = error |
| 257 | +dotnet_naming_rule.private_fields_must_be_prefixed_with_underscore.style = prefix_underscore_style |
| 258 | +dotnet_naming_rule.private_fields_must_be_prefixed_with_underscore.symbol = private_field_symbol |
| 259 | + |
| 260 | +# Rule: non-private fields |
| 261 | +dotnet_naming_rule.non-private_fields_must_be_pascal_case.severity = error |
| 262 | +dotnet_naming_rule.non-private_fields_must_be_pascal_case.style = pascal_case_style |
| 263 | +dotnet_naming_rule.non-private_fields_must_be_pascal_case.symbol = non_private_field_symbol |
| 264 | + |
| 265 | +# Rule: abstract class |
| 266 | +dotnet_naming_rule.abstract_class_must_be_suffixed_with_base.severity = suggestion |
| 267 | +dotnet_naming_rule.abstract_class_must_be_suffixed_with_base.style = suffix_base_style |
| 268 | +dotnet_naming_rule.abstract_class_must_be_suffixed_with_base.symbol = abstract_class_symbol |
| 269 | + |
| 270 | +# Rule: async method |
| 271 | +dotnet_naming_rule.async_method_must_be_suffixed_with_async.severity = error |
| 272 | +dotnet_naming_rule.async_method_must_be_suffixed_with_async.style = suffix_async_style |
| 273 | +dotnet_naming_rule.async_method_must_be_suffixed_with_async.symbol = async_method_symbol |
| 274 | + |
| 275 | +# Rule: interface |
| 276 | +dotnet_naming_rule.interface_must_be_prefixed_with_i.severity = error |
| 277 | +dotnet_naming_rule.interface_must_be_prefixed_with_i.style = prefix_i_style |
| 278 | +dotnet_naming_rule.interface_must_be_prefixed_with_i.symbol = interface_type_symbol |
| 279 | + |
| 280 | +# Rule: parameters |
| 281 | +dotnet_naming_rule.parameter_must_be_camel_case.severity = error |
| 282 | +dotnet_naming_rule.parameter_must_be_camel_case.style = camel_case_style |
| 283 | +dotnet_naming_rule.parameter_must_be_camel_case.symbol = parameter_symbol |
| 284 | + |
| 285 | +# Rule: types (non-interface) |
| 286 | +dotnet_naming_rule.type_must_by_pascal_case.severity = error |
| 287 | +dotnet_naming_rule.type_must_by_pascal_case.style = pascal_case_style |
| 288 | +dotnet_naming_rule.type_must_by_pascal_case.symbol = type_symbol |
| 289 | + |
| 290 | +# Rule: members |
| 291 | +dotnet_naming_rule.member_must_by_pascal_case.severity = error |
| 292 | +dotnet_naming_rule.member_must_by_pascal_case.style = pascal_case_style |
| 293 | +dotnet_naming_rule.member_must_by_pascal_case.symbol = member_symbol |
0 commit comments