Wednesday, May 1, 2024

Customizing .editorconfig file

Summary: A few non-default settings in the .editorconfig file that will improve the code.
Before checking in code updates, I prefer the compiler output (and the Visual Studio Error List tab) to show no errors (obviously) or warnings. In most cases, the warnings are useful (I learned a few programming trick from some), but some (mostly, IntelliSense) warnings are a bit irritating, so I prefer to supress them. To allow my warning supression settings to be shared across the team, I put them in the .editorconfig file, which gets saved in the source control along with the project. The following settings override the defaults:
# Expression-level preferences
csharp_style_unused_value_expression_statement_preference = unused_local_variable:none

# Indentation preferences
csharp_indent_labels = flush_left

# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = silent