Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@eksperimental
Last active August 21, 2022 12:14
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eksperimental/6a43b9a0ab8d718f5886e7025062fcbd to your computer and use it in GitHub Desktop.
Save eksperimental/6a43b9a0ab8d718f5886e7025062fcbd to your computer and use it in GitHub Desktop.
.editorconfig for Elixir projects
# EditorConfig is awesome: http://EditorConfig.org
# .editorconfig for Elixir projects
# https://git.io/elixir-editorconfig
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{md, markdown, eex}]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
#[*.bat]
#end_of_line = crlf
@christopheradams
Copy link

What's the reason for not trimming trailing whitespace in markdown and eex files?

@christopheradams
Copy link

Ok, I read up on some reasons for this, such as indented blank lines being OK (or needed) for some people, and some markdown flavors turning two trailing spaces into a carriage return (not sure about that one). For the Elixir Style Guide it should be true though, to enforce the same rule as the linter.

@christopheradams
Copy link

I also wonder if it would be helpful for people learning Elixir to see all the file extensions that these rules apply to, rather than a [*] catch all. What do you think?

@eksperimental
Copy link
Author

regarding trailing white space it was that issue with the two trailing white-spaces and the carriage return.
We can change that for the Elixir Style guide.

I can't recall right now what was the reason why I have used it for eex files though.

I prefer to have a general rule that applies to everything, and if some files don't fit in those rule, exclude them, than the other way around. In simple words, it's easier to exclude than to include.

@eksperimental
Copy link
Author

@christopheradams do you have a proposal of an .editorconfig explicitly listing the file extensions? I would like to see it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment