.editorconfig
# top-level EditorConfig file
root = true
###############################################################################
# GLOBAL SETTINGS
###############################################################################
[*]
indent_style = space
indent_size = 4
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
###############################################################################
# C# FILES
###############################################################################
[*.cs]
# Indentation & spacing
indent_size = 4
tab_width = 4
# C# style preferences
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion
csharp_style_prefer_braces = true:warning
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
# using directives
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = true
# Expression-level preferences
csharp_style_prefer_simplified_boolean_expressions = true:suggestion
csharp_style_prefer_simplified_interpolation = true:suggestion
csharp_style_prefer_inferred_tuple_names = true:suggestion
csharp_style_prefer_inferred_anonymous_type_member_names = true:suggestion
###############################################################################
# CODE ANALYSIS RULES
###############################################################################
# Severity levels: none, suggestion, warning, error
# Nullable
dotnet_diagnostic.CS8618.severity = warning
dotnet_diagnostic.CS8602.severity = warning
# Style suggestions
dotnet_diagnostic.IDE0055.severity = warning # formatting
dotnet_diagnostic.IDE0060.severity = suggestion # unused parameters
dotnet_diagnostic.IDE0044.severity = suggestion # make field readonly
###############################################################################
# NAMING RULES
###############################################################################
# 1) Private fields: _camelCase
dotnet_naming_rule.private_fields_should_be_camelcase.severity = suggestion
dotnet_naming_rule.private_fields_should_be_camelcase.symbols = private_fields
dotnet_naming_rule.private_fields_should_be_camelcase.style = camel_case_underscore
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.camel_case_underscore.required_prefix = _
dotnet_naming_style.camel_case_underscore.capitalization = camel_case
# 2) Interfaces: ICapitalized
dotnet_naming_rule.interfaces_start_with_i.severity = suggestion
dotnet_naming_rule.interfaces_start_with_i.symbols = interfaces
dotnet_naming_rule.interfaces_start_with_i.style = interface_prefix
dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_style.interface_prefix.required_prefix = I
dotnet_naming_style.interface_prefix.capitalization = pascal_case
###############################################################################
# SPECIFIC FORMATTING FOR FILES
###############################################################################
# JSON, XML, config files = 2 spaces
[*.{json,xml,config}]
indent_size = 2
# Markdown = ignore trailing whitespace
[*.md]
trim_trailing_whitespace = false