POSIX requires non-empty files to feature a final end of line (e.g. \n
line feed) terminator, and in general EditorConfig does a good job of helping users to enforce this.
For blank files, however, POSIX does allow for the omission of final end of line terminators. In the event that EditorConfig encounters a file with absolutely no content, it should not warn (and text editor plugins should not auto-insert) about end of line terminators.
In Atom for example, saving a blank file with EditorConfig and insert_final_newline
rule enabled, does not present an extra end of line terminator. Neither does Vim. That is acceptable and storage-optimal behavior as far as POSIX is concerned. Not sure about how other EditorConfig toolsets behave.
If we ignore backwards compatibility, then EditorConfig should clarify final eol rule behavior. EditorConfig plugins and linters should go ahead and check for empty files before warning or auto-inserting final eol terminators. This could temporarily break some CI configurations, though the end result is that user data is more POSIX compliant.
However, if backwards compatibility is preeminent, then we may want to create a new option for this rule, something like blank_files_skip_eol
, which takes values true
, false
, or none
(not enforced). And encourage the community of EditorConfig tools to update and encourage good form.