Skip to content

Commit 9188b97

Browse files
committed
Add .editorconfig based on Roslyn's
Should have sane defaults, we will tweak as necessary.
1 parent c45bb39 commit 9188b97

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.editorconfig

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# EditorConfig is awesome:http://EditorConfig.org
2+
# Based on: https://raw.githubusercontent.com/dotnet/roslyn/master/.editorconfig
3+
4+
# top-most EditorConfig file
5+
root = true
6+
7+
# Don't use tabs for indentation.
8+
[*]
9+
indent_style = space
10+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
11+
12+
# Code files
13+
[*.{cs,csx,vb,vbx}]
14+
indent_size = 4
15+
insert_final_newline = true
16+
charset = utf-8-bom
17+
18+
# Xml project files
19+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
20+
indent_size = 2
21+
22+
# Xml config files
23+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
24+
indent_size = 2
25+
26+
# JSON files
27+
[*.json]
28+
indent_size = 2
29+
30+
# Dotnet code style settings:
31+
[*.{cs,vb}]
32+
# Sort using and Import directives with System.* appearing first
33+
dotnet_sort_system_directives_first = true
34+
# Avoid "this." and "Me." if not necessary
35+
dotnet_style_qualification_for_field = false:suggestion
36+
dotnet_style_qualification_for_property = false:suggestion
37+
dotnet_style_qualification_for_method = false:suggestion
38+
dotnet_style_qualification_for_event = false:suggestion
39+
40+
# Use language keywords instead of framework type names for type references
41+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
42+
dotnet_style_predefined_type_for_member_access = true:suggestion
43+
44+
# Suggest more modern language features when available
45+
dotnet_style_object_initializer = true:suggestion
46+
dotnet_style_collection_initializer = true:suggestion
47+
dotnet_style_coalesce_expression = true:suggestion
48+
dotnet_style_null_propagation = true:suggestion
49+
dotnet_style_explicit_tuple_names = true:suggestion
50+
51+
# CSharp code style settings:
52+
[*.cs]
53+
# Prefer "var" everywhere
54+
csharp_style_var_for_built_in_types = true:suggestion
55+
csharp_style_var_when_type_is_apparent = true:suggestion
56+
csharp_style_var_elsewhere = true:suggestion
57+
58+
# Prefer method-like constructs to have a block body
59+
csharp_style_expression_bodied_methods = false:none
60+
csharp_style_expression_bodied_constructors = false:none
61+
csharp_style_expression_bodied_operators = false:none
62+
63+
# Prefer property-like constructs to have an expression-body
64+
csharp_style_expression_bodied_properties = true:none
65+
csharp_style_expression_bodied_indexers = true:none
66+
csharp_style_expression_bodied_accessors = true:none
67+
68+
# Suggest more modern language features when available
69+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
70+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
71+
csharp_style_inlined_variable_declaration = true:suggestion
72+
csharp_style_throw_expression = true:suggestion
73+
csharp_style_conditional_delegate_call = true:suggestion
74+
75+
# Newline settings
76+
csharp_new_line_before_open_brace = all
77+
csharp_new_line_before_else = true
78+
csharp_new_line_before_catch = true
79+
csharp_new_line_before_finally = true
80+
csharp_new_line_before_members_in_object_initializers = true
81+
csharp_new_line_before_members_in_anonymous_types = true

0 commit comments

Comments
 (0)