Last active
October 6, 2021 00:53
-
-
Save algonzalez/bf0e3b92e16c22bd33b14c53f1d42540 to your computer and use it in GitHub Desktop.
Basic .editorconfig with some .NET rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see http://editorconfig.org/ for details | |
# top-most EditorConfig file; stops searching parent directories. | |
root = true | |
# Defaults: UTF-8, Windows-style newline, | |
# 4 space indents, | |
# newline ending every file, | |
# trim trailing whitespace | |
[*] | |
charset = utf-8 | |
end_of_line = crlf | |
indent_size = 4 | |
indent_style = space | |
insert_final_newline = true | |
trim_trailing_whitespace = true | |
[*.{css,htm,html,js,json,jsx,less,sass,scss,svg,ts,tsx,vue}] | |
indent_size = 2 | |
# trailing whitespace may be relevant | |
[*.{diff,md,markdown}] | |
trim_trailing_whitespace = false | |
# Batch Files | |
[*.{cmd,bat}] | |
end_of_line = crlf | |
# Bash Files | |
[*.sh] | |
end_of_line = lf | |
# Visual Studio solution files | |
[*.sln] | |
indent_style= tab | |
# Visual Studio XML project files | |
[*.{csproj,vbproj}] | |
end_of_line = crlf | |
indent_size = 2 | |
# TODO: .NET extensions to .editorconfig file | |
# see: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview | |
[*.cs] | |
# IDE0017: Use object initializers | |
dotnet_style_object_initializer = false | |
# IDE0057: Use range operator `..` in place of Substring | |
csharp_style_prefer_range_operator = false | |
# IDE0063: Use simple 'using' statement | |
csharp_prefer_simple_using_statement = false | |
# IDE0090: Simplify 'new' expression | |
csharp_style_implicit_object_creation_when_type_is_apparent = false | |
# -- TODO: still evaluating/testing | |
# for other rules, see: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options | |
# also see: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ | |
# Consider VS Code setting: "[csharp]": { "editor.formatOnPaste": true, "editor.formatOnSave": true } | |
csharp_new_line_before_open_brace = namespaces, types, methods, properties | |
csharp_new_line_before_catch = true | |
csharp_new_line_before_else = true | |
csharp_new_line_before_finally = true | |
csharp_preserve_single_line_blocks = true | |
csharp_preserve_single_line_statements = true | |
csharp_style_pattern_local_over_anonymous_function = false | |
csharp_using_directive_placement = outside_namespace | |
# Declare as int instead of Int32 | |
dotnet_style_predefined_type_for_locals_parameters_members = true | |
dotnet_style_predefined_type_for_member_access = true | |
# Handle usings -- not sure if this is working in VS Code | |
dotnet_separate_import_directive_groups = false | |
dotnet_sort_system_directives_first = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment