Skip to content

Commit b5573d9

Browse files
authored
Update .editorconfig template with new defaults (dotnet#42059)
2 parents a91adc5 + 23337b9 commit b5573d9

File tree

2 files changed

+32
-10
lines changed
  • template_feed/Microsoft.DotNet.Common.ItemTemplates/content/EditorConfig/Dotnet
  • test/dotnet-new.Tests/Approvals/AllCommonItemsCreate.-o#EditorConfig-file#-n#item.verified/EditorConfig-file

2 files changed

+32
-10
lines changed

template_feed/Microsoft.DotNet.Common.ItemTemplates/content/EditorConfig/Dotnet/.editorconfig

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ indent_size = 4
1818
tab_width = 4
1919

2020
# New line preferences
21-
end_of_line = crlf
2221
insert_final_newline = false
2322

2423
#### .NET Coding Conventions ####
@@ -52,13 +51,16 @@ dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
5251
dotnet_style_coalesce_expression = true:suggestion
5352
dotnet_style_collection_initializer = true:suggestion
5453
dotnet_style_explicit_tuple_names = true:suggestion
54+
dotnet_style_namespace_match_folder = true:suggestion
5555
dotnet_style_null_propagation = true:suggestion
5656
dotnet_style_object_initializer = true:suggestion
5757
dotnet_style_operator_placement_when_wrapping = beginning_of_line
5858
dotnet_style_prefer_auto_properties = true:suggestion
59+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
5960
dotnet_style_prefer_compound_assignment = true:suggestion
6061
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
6162
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
63+
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:suggestion
6264
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
6365
dotnet_style_prefer_inferred_tuple_names = true:suggestion
6466
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
@@ -77,9 +79,6 @@ dotnet_remove_unnecessary_suppression_exclusions = none
7779
#### C# Coding Conventions ####
7880
[*.cs]
7981

80-
# namespace style
81-
csharp_style_namespace_declarations=file_scoped:suggestion
82-
8382
# var preferences
8483
csharp_style_var_elsewhere = false:silent
8584
csharp_style_var_for_built_in_types = false:silent
@@ -98,6 +97,7 @@ csharp_style_expression_bodied_properties = true:silent
9897
# Pattern matching preferences
9998
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
10099
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
100+
csharp_style_prefer_extended_property_pattern = true:suggestion
101101
csharp_style_prefer_not_pattern = true:suggestion
102102
csharp_style_prefer_pattern_matching = true:silent
103103
csharp_style_prefer_switch_expression = true:suggestion
@@ -106,20 +106,31 @@ csharp_style_prefer_switch_expression = true:suggestion
106106
csharp_style_conditional_delegate_call = true:suggestion
107107

108108
# Modifier preferences
109+
csharp_prefer_static_anonymous_function = true:suggestion
109110
csharp_prefer_static_local_function = true:warning
110111
csharp_preferred_modifier_order = public,private,protected,internal,file,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
112+
csharp_style_prefer_readonly_struct = true:suggestion
113+
csharp_style_prefer_readonly_struct_member = true:suggestion
111114

112115
# Code-block preferences
113116
csharp_prefer_braces = true:silent
114117
csharp_prefer_simple_using_statement = true:suggestion
118+
csharp_style_namespace_declarations = file_scoped:suggestion
119+
csharp_style_prefer_method_group_conversion = true:silent
120+
csharp_style_prefer_primary_constructors = true:suggestion
121+
csharp_style_prefer_top_level_statements = true:silent
115122

116123
# Expression-level preferences
117124
csharp_prefer_simple_default_expression = true:suggestion
118125
csharp_style_deconstructed_variable_declaration = true:suggestion
126+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
119127
csharp_style_inlined_variable_declaration = true:suggestion
120-
csharp_style_pattern_local_over_anonymous_function = true:suggestion
121128
csharp_style_prefer_index_operator = true:suggestion
129+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
130+
csharp_style_prefer_null_check_over_type_check = true:suggestion
122131
csharp_style_prefer_range_operator = true:suggestion
132+
csharp_style_prefer_tuple_swap = true:suggestion
133+
csharp_style_prefer_utf8_string_literals = true:suggestion
123134
csharp_style_throw_expression = true:suggestion
124135
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
125136
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

test/dotnet-new.Tests/Approvals/AllCommonItemsCreate.-o#EditorConfig-file#-n#item.verified/EditorConfig-file/.editorconfig

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ indent_size = 4
1818
tab_width = 4
1919

2020
# New line preferences
21-
end_of_line = crlf
2221
insert_final_newline = false
2322

2423
#### .NET Coding Conventions ####
@@ -52,13 +51,16 @@ dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
5251
dotnet_style_coalesce_expression = true:suggestion
5352
dotnet_style_collection_initializer = true:suggestion
5453
dotnet_style_explicit_tuple_names = true:suggestion
54+
dotnet_style_namespace_match_folder = true:suggestion
5555
dotnet_style_null_propagation = true:suggestion
5656
dotnet_style_object_initializer = true:suggestion
5757
dotnet_style_operator_placement_when_wrapping = beginning_of_line
5858
dotnet_style_prefer_auto_properties = true:suggestion
59+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
5960
dotnet_style_prefer_compound_assignment = true:suggestion
6061
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
6162
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
63+
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:suggestion
6264
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
6365
dotnet_style_prefer_inferred_tuple_names = true:suggestion
6466
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
@@ -77,9 +79,6 @@ dotnet_remove_unnecessary_suppression_exclusions = none
7779
#### C# Coding Conventions ####
7880
[*.cs]
7981

80-
# namespace style
81-
csharp_style_namespace_declarations=file_scoped:suggestion
82-
8382
# var preferences
8483
csharp_style_var_elsewhere = false:silent
8584
csharp_style_var_for_built_in_types = false:silent
@@ -98,6 +97,7 @@ csharp_style_expression_bodied_properties = true:silent
9897
# Pattern matching preferences
9998
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
10099
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
100+
csharp_style_prefer_extended_property_pattern = true:suggestion
101101
csharp_style_prefer_not_pattern = true:suggestion
102102
csharp_style_prefer_pattern_matching = true:silent
103103
csharp_style_prefer_switch_expression = true:suggestion
@@ -106,20 +106,31 @@ csharp_style_prefer_switch_expression = true:suggestion
106106
csharp_style_conditional_delegate_call = true:suggestion
107107

108108
# Modifier preferences
109+
csharp_prefer_static_anonymous_function = true:suggestion
109110
csharp_prefer_static_local_function = true:warning
110111
csharp_preferred_modifier_order = public,private,protected,internal,file,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
112+
csharp_style_prefer_readonly_struct = true:suggestion
113+
csharp_style_prefer_readonly_struct_member = true:suggestion
111114

112115
# Code-block preferences
113116
csharp_prefer_braces = true:silent
114117
csharp_prefer_simple_using_statement = true:suggestion
118+
csharp_style_namespace_declarations = file_scoped:suggestion
119+
csharp_style_prefer_method_group_conversion = true:silent
120+
csharp_style_prefer_primary_constructors = true:suggestion
121+
csharp_style_prefer_top_level_statements = true:silent
115122

116123
# Expression-level preferences
117124
csharp_prefer_simple_default_expression = true:suggestion
118125
csharp_style_deconstructed_variable_declaration = true:suggestion
126+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
119127
csharp_style_inlined_variable_declaration = true:suggestion
120-
csharp_style_pattern_local_over_anonymous_function = true:suggestion
121128
csharp_style_prefer_index_operator = true:suggestion
129+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
130+
csharp_style_prefer_null_check_over_type_check = true:suggestion
122131
csharp_style_prefer_range_operator = true:suggestion
132+
csharp_style_prefer_tuple_swap = true:suggestion
133+
csharp_style_prefer_utf8_string_literals = true:suggestion
123134
csharp_style_throw_expression = true:suggestion
124135
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
125136
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

0 commit comments

Comments
 (0)