|
| 1 | +# Documentation: |
| 2 | +# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference |
| 3 | + |
| 4 | +# Top-most EditorConfig file |
| 5 | +root = true |
| 6 | + |
| 7 | +[*] |
| 8 | +insert_final_newline = true |
| 9 | +end_of_line = crlf |
| 10 | +indent_style = tab |
| 11 | + |
| 12 | +[*.{cs,vb}] |
| 13 | +# Sort using and Import directives with System.* appearing first |
| 14 | +dotnet_sort_system_directives_first = true |
| 15 | + |
| 16 | +# Avoid "this." and "Me." if not necessary |
| 17 | +dotnet_style_qualification_for_event = false:warning |
| 18 | +dotnet_style_qualification_for_field = false:warning |
| 19 | +dotnet_style_qualification_for_method = false:warning |
| 20 | +dotnet_style_qualification_for_property = false:warning |
| 21 | + |
| 22 | +# Use language keywords instead of framework type names for type references |
| 23 | +dotnet_style_predefined_type_for_locals_parameters_members = true:warning |
| 24 | +dotnet_style_predefined_type_for_member_access = true:warning |
| 25 | + |
| 26 | +# Suggest explicit accessibility modifiers |
| 27 | +dotnet_style_require_accessibility_modifiers = always:suggestion |
| 28 | + |
| 29 | +# Suggest more modern language features when available |
| 30 | +dotnet_style_explicit_tuple_names = true:warning |
| 31 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 32 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 33 | +dotnet_style_prefer_conditional_expression_over_assignment = true:none |
| 34 | +dotnet_style_prefer_conditional_expression_over_return = true:none |
| 35 | +dotnet_style_coalesce_expression = true:suggestion |
| 36 | +dotnet_style_null_propagation = true:suggestion |
| 37 | + |
| 38 | +# Definitions |
| 39 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum, delegate, type_parameter |
| 40 | +dotnet_naming_symbols.methods_properties.applicable_kinds = method, local_function, property |
| 41 | +dotnet_naming_symbols.public_symbols.applicable_kinds = property, method, field, event |
| 42 | +dotnet_naming_symbols.public_symbols.applicable_accessibilities = public |
| 43 | +dotnet_naming_symbols.constant_fields.applicable_kinds = field |
| 44 | +dotnet_naming_symbols.constant_fields.required_modifiers = const |
| 45 | +dotnet_naming_symbols.private_protected_internal_fields.applicable_kinds = field |
| 46 | +dotnet_naming_symbols.private_protected_internal_fields.applicable_accessibilities = private, protected, internal |
| 47 | +dotnet_naming_symbols.parameters_locals.applicable_kinds = parameter, local |
| 48 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 49 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 50 | + |
| 51 | +# Name all types using PascalCase |
| 52 | +dotnet_naming_rule.types_must_be_capitalized.symbols = types |
| 53 | +dotnet_naming_rule.types_must_be_capitalized.style = pascal_case_style |
| 54 | +dotnet_naming_rule.types_must_be_capitalized.severity = warning |
| 55 | + |
| 56 | +# Name all methods and properties using PascalCase |
| 57 | +dotnet_naming_rule.methods_properties_must_be_capitalized.symbols = methods_properties |
| 58 | +dotnet_naming_rule.methods_properties_must_be_capitalized.style = pascal_case_style |
| 59 | +dotnet_naming_rule.methods_properties_must_be_capitalized.severity = warning |
| 60 | + |
| 61 | +# Name all public members using PascalCase |
| 62 | +dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols |
| 63 | +dotnet_naming_rule.public_members_must_be_capitalized.style = pascal_case_style |
| 64 | +dotnet_naming_rule.public_members_must_be_capitalized.severity = warning |
| 65 | + |
| 66 | +# Name all constant fields using PascalCase |
| 67 | +dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields |
| 68 | +dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case_style |
| 69 | +dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = suggestion |
| 70 | + |
| 71 | +# Name all private and internal fields using camelCase |
| 72 | +dotnet_naming_rule.private_protected_internal_fields_must_be_camel_case.symbols = private_protected_internal_fields |
| 73 | +dotnet_naming_rule.private_protected_internal_fields_must_be_camel_case.style = camel_case_style |
| 74 | +dotnet_naming_rule.private_protected_internal_fields_must_be_camel_case.severity = warning |
| 75 | + |
| 76 | +# Name all parameters and locals using camelCase |
| 77 | +dotnet_naming_rule.parameters_locals_must_be_camel_case.symbols = parameters_locals |
| 78 | +dotnet_naming_rule.parameters_locals_must_be_camel_case.style = camel_case_style |
| 79 | +dotnet_naming_rule.parameters_locals_must_be_camel_case.severity = warning |
| 80 | + |
| 81 | +# Name all private fields starting with underscore |
| 82 | +dotnet_naming_rule.private_members_with_underscore.symbols = private_fields |
| 83 | +dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore |
| 84 | +dotnet_naming_rule.private_members_with_underscore.severity = suggestion |
| 85 | + |
| 86 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 87 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 88 | + |
| 89 | +dotnet_naming_style.prefix_underscore.capitalization = camel_case |
| 90 | +dotnet_naming_style.prefix_underscore.required_prefix = _ |
| 91 | + |
| 92 | +[*.cs] |
| 93 | +csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion |
| 94 | + |
| 95 | +# Only use "var" when it's obvious what the variable type is |
| 96 | +csharp_style_var_for_built_in_types = false:warning |
| 97 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 98 | +csharp_style_var_elsewhere = false:none |
| 99 | + |
| 100 | +# Prefer method-like constructs to have a block body |
| 101 | +csharp_style_expression_bodied_methods = false:none |
| 102 | +csharp_style_expression_bodied_constructors = false:none |
| 103 | +csharp_style_expression_bodied_operators = false:none |
| 104 | + |
| 105 | +# Prefer property-like constructs to have an expression-body |
| 106 | +csharp_style_expression_bodied_properties = true:none |
| 107 | +csharp_style_expression_bodied_indexers = true:none |
| 108 | +csharp_style_expression_bodied_accessors = true:none |
| 109 | + |
| 110 | +# Suggest more modern language features when available |
| 111 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 112 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 113 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 114 | +csharp_style_throw_expression = true:suggestion |
| 115 | +csharp_style_conditional_delegate_call = true:suggestion |
| 116 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 117 | + |
| 118 | +# Newline settings |
| 119 | +csharp_new_line_before_open_brace = all |
| 120 | +csharp_new_line_before_else = true |
| 121 | +csharp_new_line_before_catch = true |
| 122 | +csharp_new_line_before_finally = true |
| 123 | +csharp_new_line_before_members_in_object_initializers = true |
| 124 | +csharp_new_line_before_members_in_anonymous_types = true |
| 125 | + |
| 126 | +# Indentation preferences |
| 127 | +csharp_indent_block_contents = true |
| 128 | +csharp_indent_braces = false |
| 129 | +csharp_indent_case_contents = true |
| 130 | +csharp_indent_switch_labels = true |
| 131 | +csharp_indent_labels = one_less_than_current |
| 132 | + |
| 133 | +# Space preferences |
| 134 | +csharp_space_after_cast = false |
| 135 | +csharp_space_after_colon_in_inheritance_clause = true |
| 136 | +csharp_space_after_comma = true |
| 137 | +csharp_space_after_dot = false |
| 138 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 139 | +csharp_space_after_semicolon_in_for_statement = true |
| 140 | +csharp_space_around_binary_operators = before_and_after |
| 141 | +csharp_space_around_declaration_statements = do_not_ignore |
| 142 | +csharp_space_before_colon_in_inheritance_clause = true |
| 143 | +csharp_space_before_comma = false |
| 144 | +csharp_space_before_dot = false |
| 145 | +csharp_space_before_open_square_brackets = false |
| 146 | +csharp_space_before_semicolon_in_for_statement = false |
| 147 | +csharp_space_between_empty_square_brackets = false |
| 148 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 149 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 150 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 151 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 152 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 153 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 154 | +csharp_space_between_parentheses = false |
| 155 | +csharp_space_between_square_brackets = false |
| 156 | + |
| 157 | +[*.{xml,csproj,targets,props,json,yml}] |
| 158 | +indent_size = 2 |
| 159 | +indent_style = space |
0 commit comments