Tech I Use: EditorConfig

“Tech I Use” is a series of blog posts that highlights some of the technologies I use for personal projects.

EditorConfig is a project that aims to enforce a standard coding style across files. It consists of a .editorconfig file and an appropriate plug-in for your editor or IDE of your choice. The plug-in uses the the configuration file to maintain certain rules such as indent styles (tab or space) and indent size (2 or 4 spaces). A full list of supported properties is available on their wiki.

Many editors support it, including Emacs, vim, Visual Studio, IntelliJ. A full list is available on http://editorconfig.org/.

Why I Use It

EditorConfig ensures I will never run into a scenario where mix indentation or mixed line endings exist inside a project. Although mostly cosmetic, the simplicity and low impact of using EditorConfig is well worth it to prevent minute things from impacting readability and Git diffs.

Try It Yourself

Details on how to use it is available on http://editorconfig.org/. Any recent repositories on neverendingqs-sandbox will have a sample .editorconfig file. Here is one from expressjs-heroku-example:

root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

Summary

I highly recommend using EditorConfig in your projects, especially those shared among multiple developers. It is very easy to setup and keeps code consistent across different developers and editors.

Software Developer | Lifelong Learner. neverendingqs.com