1
+ # Remove the line below if you want to inherit .editorconfig settings from higher directories
1
2
root = true
2
3
4
+ # JSON files
5
+ [* .json ]
6
+ indent_style = tab
7
+ # Unfortunately, anything other than tab_width and indent_size 1 causes VS to become whimsical about indenting.
8
+ indent_size = 1
9
+ tab_width = 1
10
+
11
+ # C# files
3
12
[* .cs ]
4
13
5
- # Core editorconfig formatting - indentation
14
+ # ### Core EditorConfig Options ####
6
15
7
- # use hard tabs for indentation
8
- indent_style = tab
9
- indent_size = 4
16
+ # Indentation and spacing
17
+ indent_size = 4
18
+ indent_style = tab
19
+ tab_width = 4
10
20
11
- # Formatting - new line options
12
- # require braces to be on a new line for types (Allman)
13
- # everything else uses K&R
14
- csharp_new_line_before_open_brace = types, methods
21
+ # New line preferences
22
+ end_of_line = crlf
23
+ insert_final_newline = false
15
24
16
- # Style - expression bodied member options
25
+ # ### .NET Coding Conventions ####
17
26
18
- # prefer block bodies for constructors
19
- csharp_style_expression_bodied_constructors = false :suggestion
20
- # prefer expression-bodied members for methods when they will be a single line
21
- csharp_style_expression_bodied_methods = when_on_single_line:suggestion
22
- # prefer expression-bodied members for properties when they will be a single line
23
- csharp_style_expression_bodied_properties = when_on_single_line:suggestion
24
- # prefer expression-bodied members for indexers when they will be a single line
25
- csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
26
- # prefer expression-bodied members for accessors when they will be a single line
27
- csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
27
+ # Organize usings
28
+ dotnet_separate_import_directive_groups = false
29
+ dotnet_sort_system_directives_first = false
28
30
29
- # Style - expression level options
31
+ # this. and Me. preferences
32
+ dotnet_style_qualification_for_event = false :suggestion
33
+ dotnet_style_qualification_for_field = false :suggestion
34
+ dotnet_style_qualification_for_method = false :suggestion
35
+ dotnet_style_qualification_for_property = false :suggestion
30
36
31
- # prefer out variables to be declared inline in the argument list of a method call when possible
32
- csharp_style_inlined_variable_declaration = true :suggestion
33
- # prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
34
- dotnet_style_predefined_type_for_member_access = true :suggestion
37
+ # Language keywords vs BCL types preferences
38
+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
39
+ # Prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
40
+ dotnet_style_predefined_type_for_member_access = true :suggestion
35
41
36
- # Style - implicit and explicit types
42
+ # Parentheses preferences
43
+ dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
44
+ dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
45
+ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
46
+ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
37
47
38
- # prefer explicit type over var to declare variables with built-in system types such as int
39
- csharp_style_var_for_built_in_types = false :suggestion
40
- # prefer explicit type over var when the type is already mentioned on the right-hand side of a declaration
41
- csharp_style_var_when_type_is_apparent = true :none
48
+ # Modifier preferences
49
+ dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
42
50
43
- [* .json ]
44
- indent_style = tab
45
- # unfortuantely anything other than tab_width and indent_size 1 causes VS to become whimsical about indenting
46
- indent_size = 1
47
- tab_width = 1
51
+ # Expression-level preferences
52
+ dotnet_style_coalesce_expression = true :suggestion
53
+ dotnet_style_collection_initializer = true :suggestion
54
+ dotnet_style_explicit_tuple_names = true :suggestion
55
+ dotnet_style_null_propagation = true :suggestion
56
+ dotnet_style_object_initializer = true :suggestion
57
+ dotnet_style_prefer_auto_properties = true :silent
58
+ dotnet_style_prefer_compound_assignment = true :suggestion
59
+ dotnet_style_prefer_conditional_expression_over_assignment = true :silent
60
+ dotnet_style_prefer_conditional_expression_over_return = true :silent
61
+ dotnet_style_prefer_inferred_anonymous_type_member_names = true :suggestion
62
+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
63
+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :suggestion
64
+ dotnet_style_prefer_simplified_interpolation = true :suggestion
65
+
66
+ # Field preferences
67
+ dotnet_style_readonly_field = true :suggestion
68
+
69
+ # Parameter preferences
70
+ dotnet_code_quality_unused_parameters = all:suggestion
71
+
72
+ # ### C# Coding Conventions ####
73
+
74
+ # var preferences
75
+ csharp_style_var_elsewhere = false :silent
76
+ csharp_style_var_for_built_in_types = false :suggestion
77
+ csharp_style_var_when_type_is_apparent = true :none
78
+
79
+ # Expression-bodied members
80
+ csharp_style_expression_bodied_lambdas = true :silent
81
+ csharp_style_expression_bodied_local_functions = false :silent
82
+ csharp_style_expression_bodied_operators = false :silent
83
+ # Prefer block bodies for constructors
84
+ csharp_style_expression_bodied_constructors = false :suggestion
85
+ # Prefer expression-bodied members for methods, properties, indexers and accessors when they will be a single line
86
+ csharp_style_expression_bodied_methods = when_on_single_line:suggestion
87
+ csharp_style_expression_bodied_properties = when_on_single_line:suggestion
88
+ csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
89
+ csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
90
+
91
+ # Pattern matching preferences
92
+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
93
+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
94
+ csharp_style_prefer_switch_expression = true :suggestion
95
+
96
+ # Null-checking preferences
97
+ csharp_style_conditional_delegate_call = true :suggestion
98
+
99
+ # Modifier preferences
100
+ csharp_prefer_static_local_function = true :suggestion
101
+ csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
102
+
103
+ # Code-block preferences
104
+ csharp_prefer_braces = true :silent
105
+ csharp_prefer_simple_using_statement = true :suggestion
106
+
107
+ # Expression-level preferences
108
+ csharp_prefer_simple_default_expression = true :suggestion
109
+ csharp_style_deconstructed_variable_declaration = true :suggestion
110
+ csharp_style_pattern_local_over_anonymous_function = true :suggestion
111
+ csharp_style_prefer_index_operator = true :suggestion
112
+ csharp_style_prefer_range_operator = true :suggestion
113
+ csharp_style_throw_expression = true :suggestion
114
+ csharp_style_unused_value_assignment_preference = discard_variable:suggestion
115
+ csharp_style_unused_value_expression_statement_preference = discard_variable:silent
116
+ # Prefer out variables to be declared inline in the argument list of a method call when possible
117
+ csharp_style_inlined_variable_declaration = true :suggestion
118
+
119
+ # 'using' directive preferences
120
+ csharp_using_directive_placement = outside_namespace:silent
121
+
122
+ # ### C# Formatting Rules ####
123
+
124
+ # New line preferences
125
+ csharp_new_line_before_catch = true
126
+ csharp_new_line_before_else = true
127
+ csharp_new_line_before_finally = true
128
+ csharp_new_line_before_members_in_anonymous_types = true
129
+ csharp_new_line_before_members_in_object_initializers = true
130
+ # Require braces to be on a new line for types (Allman). Everything else uses K&R.
131
+ csharp_new_line_before_open_brace = types
132
+ csharp_new_line_between_query_expression_clauses = true
133
+
134
+ # Indentation preferences
135
+ csharp_indent_block_contents = true
136
+ csharp_indent_braces = false
137
+ csharp_indent_case_contents = true
138
+ csharp_indent_case_contents_when_block = true
139
+ csharp_indent_labels = one_less_than_current
140
+ csharp_indent_switch_labels = true
141
+
142
+ # Space preferences
143
+ csharp_space_after_cast = false
144
+ csharp_space_after_colon_in_inheritance_clause = true
145
+ csharp_space_after_comma = true
146
+ csharp_space_after_dot = false
147
+ csharp_space_after_keywords_in_control_flow_statements = true
148
+ csharp_space_after_semicolon_in_for_statement = true
149
+ csharp_space_around_binary_operators = before_and_after
150
+ csharp_space_around_declaration_statements = false
151
+ csharp_space_before_colon_in_inheritance_clause = true
152
+ csharp_space_before_comma = false
153
+ csharp_space_before_dot = false
154
+ csharp_space_before_open_square_brackets = false
155
+ csharp_space_before_semicolon_in_for_statement = false
156
+ csharp_space_between_empty_square_brackets = false
157
+ csharp_space_between_method_call_empty_parameter_list_parentheses = false
158
+ csharp_space_between_method_call_name_and_opening_parenthesis = false
159
+ csharp_space_between_method_call_parameter_list_parentheses = false
160
+ csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
161
+ csharp_space_between_method_declaration_name_and_open_parenthesis = false
162
+ csharp_space_between_method_declaration_parameter_list_parentheses = false
163
+ csharp_space_between_parentheses = false
164
+ csharp_space_between_square_brackets = false
165
+
166
+ # Wrapping preferences
167
+ csharp_preserve_single_line_blocks = true
168
+ csharp_preserve_single_line_statements = false
169
+
170
+ # ### Naming styles ####
171
+
172
+ # Naming rules
173
+
174
+ dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
175
+ dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
176
+ dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
177
+
178
+ dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
179
+ dotnet_naming_rule.types_should_be_pascal_case.symbols = types
180
+ dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
181
+
182
+ dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
183
+ dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
184
+ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
185
+
186
+ # Symbol specifications
187
+
188
+ dotnet_naming_symbols.interface.applicable_kinds = interface
189
+ dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
190
+ dotnet_naming_symbols.interface.required_modifiers =
191
+
192
+ dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
193
+ dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
194
+ dotnet_naming_symbols.types.required_modifiers =
195
+
196
+ dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
197
+ dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
198
+ dotnet_naming_symbols.non_field_members.required_modifiers =
199
+
200
+ # Naming styles
201
+
202
+ dotnet_naming_style.pascal_case.required_prefix =
203
+ dotnet_naming_style.pascal_case.required_suffix =
204
+ dotnet_naming_style.pascal_case.word_separator =
205
+ dotnet_naming_style.pascal_case.capitalization = pascal_case
206
+
207
+ dotnet_naming_style.begins_with_i.required_prefix = I
208
+ dotnet_naming_style.begins_with_i.required_suffix =
209
+ dotnet_naming_style.begins_with_i.word_separator =
210
+ dotnet_naming_style.begins_with_i.capitalization = pascal_case
0 commit comments