charset
indent_style
indent_size
tab_width
end_of_line
trim_trailing_whitespace
insert_final_newline
These are all sensible things to enforce (with the exception of tab_width, which is actually a display preference). Subjectively, other things are mostly flexible.For charset, this needs to be defined since charsets share byte encodings:
http://www.fileformat.info/info/charset/UTF-8/list.htm
http://www.fileformat.info/info/charset/US-ASCII/list.htm
Same goes for new line at the end of the file, how do you know ALL files of this type are meant to end with a new line or not?
Inference doesn't completely solve the problem that editorconfig solves. That said, if you don't want editorconfig then don't use it. If you're working on a project that uses editorconfig, feel free to ignore it - as long as you adhere to the code style of that project. editorconfig is simply a tool to help you adhere to a project code guidelines.
> Crucially, what about new files?
vim-sleuth handles this one by looking at similar files in the same directory (or the rest of the tree, if it doesn't find any.) > For charset, [...]
Almost all code bases use UTF-8 without BOM, which also happens to be the default encoding in most editors. > Same goes for new line at the end of the file,
> how do you know ALL files of this type are meant
> to end with a new line [...] ?
POSIX wants the newline.I get your point though. I used to use editorconfig myself, but it didn't really do anything for me. IMHO linters/formatters do a much better job.
Linters and formatters are great for enforcing code styles but they tend to be per language and require more configuration, shy of ripping off an existing spec.
If you don't want to go the whole hog and only need some basic constraints then editorconfig is easy to throw into a repo root.