|
| 1 | +# editorconfig: http://editorconfig.org/ |
| 2 | +# Help developers standardize spaces, tabs, encoding, end-line characters across editors |
| 3 | + |
| 4 | +# top-most .editorconfig file |
| 5 | +root = true |
| 6 | + |
| 7 | +# defaults for all files |
| 8 | +[*] |
| 9 | +charset = utf-8 |
| 10 | +end_of_line = crlf |
| 11 | +indent_size = 4 |
| 12 | +indent_style = space |
| 13 | +insert_final_newline = true |
| 14 | +trim_trailing_whitespace = true |
| 15 | + |
| 16 | +# markdown, diff overrides |
| 17 | +# two trailing spaces are required for <br/> and hard line-breaks in markdown files |
| 18 | +# see: (https://daringfireball.net/projects/markdown/syntax#p) and (http://spec.commonmark.org/0.27/#hard-line-break) |
| 19 | +[*.{md,diff}] |
| 20 | +trim_trailing_whitespace = false |
| 21 | + |
| 22 | +[*.{md,xml,gprops,man,natvis}] |
| 23 | +indent_size = 2 |
| 24 | + |
| 25 | +# manifest validation tool requires BOM |
| 26 | +[*.man] |
| 27 | +charset = utf-8-bom |
| 28 | + |
| 29 | +# XML-based MSBuild and Visual Studio files |
| 30 | +[*.{props,targets,settings,*proj,vcxitems,filters}] |
| 31 | +indent_size = 2 |
| 32 | + |
| 33 | +# Exceptions to the above *proj wildcard |
| 34 | +[*.vdproj] |
| 35 | +indent_size = 4 |
| 36 | + |
| 37 | +# Visual Studio uses hard tabs for SLN files, so don't fight it |
| 38 | +[*.sln] |
| 39 | +indent_style = tab |
| 40 | + |
| 41 | +# YAML overrides |
| 42 | +[*.{yml,yaml}] |
| 43 | +indent_size = 2 |
| 44 | + |
| 45 | +# package.json overrides |
| 46 | +# Updating package.json with NPM will revert indentation to 2 spaces so to |
| 47 | +# reduce churn, let's align to NPM and specify indent size 2 |
| 48 | +[package.json] |
| 49 | +indent_size = 2 |
| 50 | + |
| 51 | +# JSON formats |
| 52 | +[{*.json,*.testlist,testmd.definition}] |
| 53 | +indent_size = 2 |
| 54 | + |
| 55 | +[*.{rc}] |
| 56 | +trim_trailing_whitespace = true |
| 57 | +insert_final_newline = true |
| 58 | + |
| 59 | +[*.{c,w}] |
| 60 | +trim_trailing_whitespace = true |
| 61 | +insert_final_newline = true |
| 62 | + |
| 63 | +[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli,idl}] |
| 64 | +trim_trailing_whitespace = true |
| 65 | +insert_final_newline = true |
| 66 | +cpp_indent_braces = false |
| 67 | +cpp_indent_multi_line_relative_to = innermost_parenthesis |
| 68 | +cpp_indent_within_parentheses = indent |
| 69 | +cpp_indent_preserve_within_parentheses = true |
| 70 | +cpp_indent_case_contents = true |
| 71 | +cpp_indent_case_labels = false |
| 72 | +cpp_indent_case_contents_when_block = false |
| 73 | +cpp_indent_lambda_braces_when_parameter = false |
| 74 | +cpp_indent_goto_labels = one_left |
| 75 | +cpp_indent_preprocessor = leftmost_column |
| 76 | +cpp_indent_access_specifiers = false |
| 77 | +cpp_indent_namespace_contents = true |
| 78 | +cpp_indent_preserve_comments = false |
| 79 | +cpp_new_line_before_open_brace_namespace = ignore |
| 80 | +cpp_new_line_before_open_brace_type = ignore |
| 81 | +cpp_new_line_before_open_brace_function = new_line |
| 82 | +cpp_new_line_before_open_brace_block = new_line |
| 83 | +cpp_new_line_before_open_brace_lambda = new_line |
| 84 | +cpp_new_line_scope_braces_on_separate_lines = true |
| 85 | +cpp_new_line_close_brace_same_line_empty_type = false |
| 86 | +cpp_new_line_close_brace_same_line_empty_function = ignore |
| 87 | +cpp_new_line_before_catch = true |
| 88 | +cpp_new_line_before_else = true |
| 89 | +cpp_new_line_before_while_in_do_while = true |
| 90 | +cpp_space_before_function_open_parenthesis = remove |
| 91 | +cpp_space_within_parameter_list_parentheses = false |
| 92 | +cpp_space_between_empty_parameter_list_parentheses = false |
| 93 | +cpp_space_after_keywords_in_control_flow_statements = true |
| 94 | +cpp_space_within_control_flow_statement_parentheses = false |
| 95 | +cpp_space_before_lambda_open_parenthesis = false |
| 96 | +cpp_space_within_cast_parentheses = false |
| 97 | +cpp_space_after_cast_close_parenthesis = false |
| 98 | +cpp_space_within_expression_parentheses = false |
| 99 | +cpp_space_before_block_open_brace = true |
| 100 | +cpp_space_between_empty_braces = false |
| 101 | +cpp_space_before_initializer_list_open_brace = false |
| 102 | +cpp_space_within_initializer_list_braces = true |
| 103 | +cpp_space_preserve_in_initializer_list = true |
| 104 | +cpp_space_before_open_square_bracket = false |
| 105 | +cpp_space_within_square_brackets = false |
| 106 | +cpp_space_before_empty_square_brackets = false |
| 107 | +cpp_space_between_empty_square_brackets = false |
| 108 | +cpp_space_group_square_brackets = true |
| 109 | +cpp_space_within_lambda_brackets = false |
| 110 | +cpp_space_between_empty_lambda_brackets = false |
| 111 | +cpp_space_before_comma = false |
| 112 | +cpp_space_after_comma = true |
| 113 | +cpp_space_remove_around_member_operators = true |
| 114 | +cpp_space_before_inheritance_colon = true |
| 115 | +cpp_space_before_constructor_colon = true |
| 116 | +cpp_space_remove_before_semicolon = true |
| 117 | +cpp_space_after_semicolon = true |
| 118 | +cpp_space_remove_around_unary_operator = true |
| 119 | +cpp_space_around_binary_operator = insert |
| 120 | +cpp_space_around_assignment_operator = insert |
| 121 | +cpp_space_pointer_reference_alignment = left |
| 122 | +cpp_space_around_ternary_operator = insert |
| 123 | +cpp_wrap_preserve_blocks = one_liners |
| 124 | + |
| 125 | +# C# overrides |
| 126 | +# Rules explanation: https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers |
| 127 | +[*.cs] |
| 128 | +# Indent settings |
| 129 | +csharp_indent_block_contents = true |
| 130 | +csharp_indent_braces = false |
| 131 | +csharp_indent_case_contents = true |
| 132 | +csharp_indent_switch_labels = true |
| 133 | + |
| 134 | +# Newline settings |
| 135 | +csharp_new_line_before_catch = true |
| 136 | +csharp_new_line_before_else = true |
| 137 | +csharp_new_line_before_finally = true |
| 138 | +csharp_new_line_before_members_in_anonymous_types = true |
| 139 | +csharp_new_line_before_members_in_object_initializers = true |
| 140 | +csharp_new_line_before_open_brace = all |
| 141 | +csharp_new_line_between_query_expression_clauses = true |
| 142 | + |
| 143 | +# Braces settings |
| 144 | +csharp_prefer_braces = true:error |
| 145 | +csharp_prefer_simple_default_expression = false:error |
| 146 | +csharp_preserve_single_line_blocks = true |
| 147 | +csharp_preserve_single_line_statements = false |
| 148 | + |
| 149 | +# Space settings |
| 150 | +csharp_space_after_cast = false |
| 151 | +csharp_space_after_colon_in_inheritance_clause = true |
| 152 | +csharp_space_after_comma = true |
| 153 | +csharp_space_after_dot = false |
| 154 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 155 | +csharp_space_after_semicolon_in_for_statement = true |
| 156 | +csharp_space_around_binary_operators = before_and_after |
| 157 | +csharp_space_around_declaration_statements = do_not_ignore |
| 158 | +csharp_space_before_colon_in_inheritance_clause = true |
| 159 | +csharp_space_before_comma = false |
| 160 | +csharp_space_before_dot = false |
| 161 | +csharp_space_before_open_square_brackets = false |
| 162 | +csharp_space_before_semicolon_in_for_statement = false |
| 163 | +csharp_space_between_empty_square_brackets = false |
| 164 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 165 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 166 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 167 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 168 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 169 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 170 | +csharp_space_between_parentheses = false |
| 171 | +csharp_space_between_square_brackets = false |
| 172 | + |
| 173 | +# Suggest more modern language features when available |
| 174 | +csharp_style_conditional_delegate_call = false:suggestion |
| 175 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 176 | +csharp_style_pattern_matching_over_as_with_null_check = false:suggestion |
| 177 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 178 | +csharp_style_throw_expression = true:suggestion |
| 179 | + |
| 180 | +# Prefer property-like constructs to have an expression-body |
| 181 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 182 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 183 | +csharp_style_expression_bodied_properties = true:suggestion |
| 184 | + |
| 185 | +# Suggest "var" when type is apparent |
| 186 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 187 | + |
| 188 | +# Sort using directives with System.* appearing first |
| 189 | +dotnet_sort_system_directives_first = true |
| 190 | + |
| 191 | +# Suggest more modern language features when available |
| 192 | +dotnet_style_coalesce_expression = true:suggestion |
| 193 | +dotnet_style_collection_initializer = true:suggestion |
| 194 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 195 | +dotnet_style_null_propagation = true:suggestion |
| 196 | +dotnet_style_object_initializer = true:suggestion |
| 197 | + |
| 198 | +# Use language keywords instead of framework type names for type references |
| 199 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 200 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 201 | + |
| 202 | +# Avoid "this." |
| 203 | +dotnet_style_qualification_for_event = false:error |
| 204 | +dotnet_style_qualification_for_field = false:error |
| 205 | +dotnet_style_qualification_for_method = false:error |
| 206 | +dotnet_style_qualification_for_property = false:error |
| 207 | + |
0 commit comments