Skip to content

Commit be08c1a

Browse files
authored
Refactor .editorconfig to focus on Kotlin and common file types (#4808)
1 parent 84edf4e commit be08c1a

File tree

1 file changed

+11
-118
lines changed

1 file changed

+11
-118
lines changed

.editorconfig

Lines changed: 11 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -12,127 +12,20 @@ end_of_line = lf
1212
charset = utf-8
1313
trim_trailing_whitespace = true
1414
insert_final_newline = true
15-
guidelines = 120
16-
17-
# Code files
18-
[*.{cs,csx,vb,vbx}]
19-
indent_size = 4
20-
21-
# Xml project files
22-
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
23-
indent_size = 2
24-
25-
# Xml config files
26-
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
27-
indent_size = 2
2815

2916
# JSON files
3017
[*.json]
3118
indent_size = 2
3219

33-
# JS files
34-
[*.{js,ts,scss,html}]
20+
# Kotlin files
21+
# noinspection EditorConfigKeyCorrectness
22+
[*.{kt,kts}]
23+
# https://pinterest.github.io/ktlint/1.0.1/rules/configuration-ktlint/#trailing-comma-on-declaration-site
24+
ij_kotlin_allow_trailing_comma = true
25+
# https://pinterest.github.io/ktlint/1.0.1/rules/configuration-ktlint/#trailing-comma-on-declaration-site
26+
trailing-comma-on-declaration-site = true
27+
# https://pinterest.github.io/ktlint/1.0.1/rules/configuration-ktlint/#trailing-comma-on-call-site
28+
ij_kotlin_allow_trailing_comma_on_call_site = true
29+
30+
[*.{scss,yml}]
3531
indent_size = 2
36-
37-
[*.{ts}]
38-
quote_type = single
39-
40-
[*.{scss,yml,csproj}]
41-
indent_size = 2
42-
43-
[*.sln]
44-
indent_style = tab
45-
46-
# Dotnet code style settings:
47-
[*.{cs,vb}]
48-
# Sort using and Import directives with System.* appearing first
49-
dotnet_sort_system_directives_first = true
50-
# Avoid "this." and "Me." if not necessary
51-
dotnet_style_qualification_for_field = false:suggestion
52-
dotnet_style_qualification_for_property = false:suggestion
53-
dotnet_style_qualification_for_method = false:suggestion
54-
dotnet_style_qualification_for_event = false:suggestion
55-
56-
# Use language keywords instead of framework type names for type references
57-
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
58-
dotnet_style_predefined_type_for_member_access = true:suggestion
59-
60-
# Suggest more modern language features when available
61-
dotnet_style_object_initializer = true:suggestion
62-
dotnet_style_collection_initializer = true:suggestion
63-
dotnet_style_coalesce_expression = true:suggestion
64-
dotnet_style_null_propagation = true:suggestion
65-
dotnet_style_explicit_tuple_names = true:suggestion
66-
67-
# Prefix private members with underscore
68-
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
69-
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
70-
dotnet_naming_rule.private_members_with_underscore.severity = suggestion
71-
72-
dotnet_naming_symbols.private_fields.applicable_kinds = field
73-
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
74-
75-
dotnet_naming_style.prefix_underscore.capitalization = camel_case
76-
dotnet_naming_style.prefix_underscore.required_prefix = _
77-
78-
# Async methods should have "Async" suffix
79-
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
80-
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
81-
dotnet_naming_rule.async_methods_end_in_async.severity = suggestion
82-
83-
dotnet_naming_symbols.any_async_methods.applicable_kinds = method
84-
dotnet_naming_symbols.any_async_methods.applicable_accessibilities = *
85-
dotnet_naming_symbols.any_async_methods.required_modifiers = async
86-
87-
dotnet_naming_style.end_in_async.required_prefix =
88-
dotnet_naming_style.end_in_async.required_suffix = Async
89-
dotnet_naming_style.end_in_async.capitalization = pascal_case
90-
dotnet_naming_style.end_in_async.word_separator =
91-
92-
# Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items.
93-
dotnet_diagnostic.CS0618.severity = suggestion
94-
95-
# Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items.
96-
dotnet_diagnostic.CS0612.severity = suggestion
97-
98-
# Remove unnecessary using directives https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005
99-
dotnet_diagnostic.IDE0005.severity = warning
100-
101-
# CSharp code style settings:
102-
[*.cs]
103-
# Prefer "var" everywhere
104-
csharp_style_var_for_built_in_types = true:suggestion
105-
csharp_style_var_when_type_is_apparent = true:suggestion
106-
csharp_style_var_elsewhere = true:suggestion
107-
108-
# Prefer method-like constructs to have a expression-body
109-
csharp_style_expression_bodied_methods = true:none
110-
csharp_style_expression_bodied_constructors = true:none
111-
csharp_style_expression_bodied_operators = true:none
112-
113-
# Prefer property-like constructs to have an expression-body
114-
csharp_style_expression_bodied_properties = true:none
115-
csharp_style_expression_bodied_indexers = true:none
116-
csharp_style_expression_bodied_accessors = true:none
117-
118-
# Suggest more modern language features when available
119-
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
120-
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
121-
csharp_style_inlined_variable_declaration = true:suggestion
122-
csharp_style_throw_expression = true:suggestion
123-
csharp_style_conditional_delegate_call = true:suggestion
124-
125-
# Newline settings
126-
csharp_new_line_before_open_brace = all
127-
csharp_new_line_before_else = true
128-
csharp_new_line_before_catch = true
129-
csharp_new_line_before_finally = true
130-
csharp_new_line_before_members_in_object_initializers = true
131-
csharp_new_line_before_members_in_anonymous_types = true
132-
133-
# Namespace settings
134-
csharp_style_namespace_declarations = file_scoped:warning
135-
136-
# Switch expression
137-
dotnet_diagnostic.CS8509.severity = error # missing switch case for named enum value
138-
dotnet_diagnostic.CS8524.severity = none # missing switch case for unnamed enum value

0 commit comments

Comments
 (0)