A Very Generic .editorconfig File

What is a .editorconfig File?

A .editorconfig file helps developers define and maintain consistent coding styles between different editors and IDEs for file with different file extensions. These configuration files are easily readable and they work nicely with version control systems. An .editorconfig file defines various settings per file extension such as charsets and tabs vs spaces.

Scott Hanselman recently wrote a blog post about this file. You can also find out more from the official docs at editorconfig.org and the Visual Studio Docs which I recommend you read.

A Very Generic .editorconfig

I wrote a generic .editorconfig file supporting the following file types:

  • C# – .cs, .csx, .cake
  • Visual Basic – .vb
  • Script – .sh, .ps1, psm1
  • Configuration – .json, .xml, .yml, .config, .props, .targets, .nuspec, .resx, .ruleset, .vsixmanifest, .vsct
  • HTML – .htm, .html
  • JavaScript – .js, .ts
  • CSS – .css, .scss, .less
  • Markdown – .md
  • Visual Studio – .sln, .csproj, .vbproj, .vcxproj, .vcxproj.filters, .proj, .projitems, .shproj

In addition, it sets various more advanced C# style settings. All C# related code styles are consistent with StyleCop’s default styles. You can find our more about the C# code style settings from the official docs and also in Kent Boogaart’s blog post.