Skip to content

Commit 78719ac

Browse files
authored
align editor config with other libraries (#3079)
1 parent 894905f commit 78719ac

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

.editorconfig

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# Note: MSAL rules used as a starting point
2-
31
# editorconfig.org
4-
# Copied from the .NET Core repo https://github.com/dotnet/corefx/blob/master/.editorconfig
52

63
# top-most EditorConfig file
74
root = true
@@ -13,7 +10,7 @@ root = true
1310
insert_final_newline = true
1411
indent_style = space
1512
indent_size = 4
16-
dotnet_diagnostic.CA1308.severity=warning
13+
trim_trailing_whitespace = true
1714

1815
[project.json]
1916
indent_size = 2
@@ -33,6 +30,7 @@ csharp_new_line_between_query_expression_clauses = true
3330
csharp_indent_block_contents = true
3431
csharp_indent_braces = false
3532
csharp_indent_case_contents = true
33+
csharp_indent_case_contents_when_block = true
3634
csharp_indent_switch_labels = true
3735
csharp_indent_labels = one_less_than_current
3836

@@ -84,24 +82,42 @@ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
8482
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
8583

8684
# Code style defaults
85+
csharp_using_directive_placement = outside_namespace:suggestion
8786
dotnet_sort_system_directives_first = true
88-
csharp_preserve_single_line_blocks = true
89-
csharp_preserve_single_line_statements = false
87+
csharp_prefer_braces = true:silent
88+
csharp_preserve_single_line_blocks = true:none
89+
csharp_preserve_single_line_statements = false:none
90+
csharp_prefer_static_local_function = true:suggestion
91+
csharp_prefer_simple_using_statement = false:none
92+
csharp_style_prefer_switch_expression = true:suggestion
93+
94+
# Code quality
95+
dotnet_style_readonly_field = true:suggestion
96+
dotnet_code_quality_unused_parameters = non_public:suggestion
9097

9198
# Expression-level preferences
9299
dotnet_style_object_initializer = true:suggestion
93100
dotnet_style_collection_initializer = true:suggestion
94101
dotnet_style_explicit_tuple_names = true:suggestion
95102
dotnet_style_coalesce_expression = true:suggestion
96103
dotnet_style_null_propagation = true:suggestion
104+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
105+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
106+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
107+
dotnet_style_prefer_auto_properties = true:suggestion
108+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
109+
dotnet_style_prefer_conditional_expression_over_return = true:silent
110+
csharp_prefer_simple_default_expression = true:suggestion
97111

98112
# Expression-bodied members
99-
csharp_style_expression_bodied_methods = false:none
100-
csharp_style_expression_bodied_constructors = false:none
101-
csharp_style_expression_bodied_operators = false:none
102-
csharp_style_expression_bodied_properties = true:none
103-
csharp_style_expression_bodied_indexers = true:none
104-
csharp_style_expression_bodied_accessors = true:none
113+
csharp_style_expression_bodied_methods = true:silent
114+
csharp_style_expression_bodied_constructors = true:silent
115+
csharp_style_expression_bodied_operators = true:silent
116+
csharp_style_expression_bodied_properties = true:silent
117+
csharp_style_expression_bodied_indexers = true:silent
118+
csharp_style_expression_bodied_accessors = true:silent
119+
csharp_style_expression_bodied_lambdas = true:silent
120+
csharp_style_expression_bodied_local_functions = true:silent
105121

106122
# Pattern matching
107123
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
@@ -112,6 +128,11 @@ csharp_style_inlined_variable_declaration = true:suggestion
112128
csharp_style_throw_expression = true:suggestion
113129
csharp_style_conditional_delegate_call = true:suggestion
114130

131+
# Other features
132+
csharp_style_prefer_index_operator = false:none
133+
csharp_style_prefer_range_operator = false:none
134+
csharp_style_pattern_local_over_anonymous_function = false:none
135+
115136
# Space preferences
116137
csharp_space_after_cast = false
117138
csharp_space_after_colon_in_inheritance_clause = true
@@ -136,6 +157,10 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
136157
csharp_space_between_parentheses = false
137158
csharp_space_between_square_brackets = false
138159

160+
# Analyzers
161+
dotnet_code_quality.CA1802.api_surface = private, internal
162+
dotnet_code_quality.CA2208.api_surface = public
163+
139164
# Id Web Rules
140165

141166
# RS0030: Do not used banned APIs
@@ -238,6 +263,9 @@ dotnet_diagnostic.CA1067.severity = error
238263
# CA1068: CancellationToken parameters must come last
239264
dotnet_diagnostic.CA1068.severity = error
240265

266+
# CA1308: Normalize strings to uppercase
267+
dotnet_diagnostic.CA1308.severity=warning
268+
241269
# CA1505: Avoid unmaintainable code
242270
dotnet_diagnostic.CA1505.severity = error
243271

@@ -558,6 +586,9 @@ indent_brace_style = Allman
558586
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
559587
indent_size = 2
560588

589+
[*.{csproj,vbproj,proj,nativeproj,locproj}]
590+
charset = utf-8
591+
561592
# Xml build files
562593
[*.builds]
563594
indent_size = 2

0 commit comments

Comments
 (0)