Skip to content

Instantly share code, notes, and snippets.

@bestknighter
Last active December 1, 2023 12:54
Show Gist options
  • Save bestknighter/be12a8595402a1e508272c47a53e4628 to your computer and use it in GitHub Desktop.
Save bestknighter/be12a8595402a1e508272c47a53e4628 to your computer and use it in GitHub Desktop.
My default starting .editorconfig for Unity projects
root=true
[*]
guidelines = 80 2px solid 18FFFFFF, 100 2px dotted 2C1EFF00, 120 1px solid 1FFFFB00, 150 2px solid 30FF0000
[*.cs]
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
###################
# Rule Severities #
###################
dotnet_diagnostic.IDE0090.severity = none # csharp_style_implicit_object_creation_when_type_is_apparent
dotnet_diagnostic.IDE0063.severity = none # csharp_prefer_simple_using_statement
####################
# Code Conventions #
####################
dotnet_style_require_accessibility_modifiers = always
csharp_style_expression_bodied_methods = when_on_single_line
csharp_style_expression_bodied_properties = when_on_single_line
csharp_style_expression_bodied_indexers = when_on_single_line
csharp_style_expression_bodied_accessors = when_on_single_line
csharp_style_expression_bodied_lambdas = when_on_single_line
csharp_style_expression_bodied_local_functions = when_on_single_line
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_not_pattern = false
csharp_style_deconstructed_variable_declaration = false
csharp_style_implicit_object_creation_when_type_is_apparent = false
csharp_prefer_simple_using_statement = false
csharp_preferred_modifier_order = readonly,override,extern,new,virtual,abstract,public,private,protected,internal,static,sealed,unsafe,volatile,async
##############
# Formatting #
##############
# New Lines
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents_when_block = false
# Spacing
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = false
csharp_space_between_parentheses = control_flow_statements
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = ignore
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = true
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_after_comma = true
csharp_space_before_comma = false
csharp_space_after_dot = false
csharp_space_before_dot = false
csharp_space_after_semicolon_in_for_statement = true
csharp_space_before_semicolon_in_for_statement = false
csharp_space_around_declaration_statements = false
csharp_space_before_open_square_brackets = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_square_brackets = false
# Others
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
csharp_using_directive_placement = outside_namespace
csharp_style_namespace_declarations = file_scoped
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
dotnet_style_namespace_match_folder = false
######################
# Naming Conventions #
######################
# Empty...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment