What is a text file according to POSIX?
If you use Linux, you'll probably have heard of POSIX, as Linux is a mostly POSIX-compliant operating system.
Recently, I learnt something that surprised me - what the POSIX specification defines a text file as.
According to POSIX, a text file is defined as
A file that contains characters organized into zero or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the
And a line is defined as
A sequence of zero or more non-<newline> characters plus a terminating <newline> character.
So if your text file doesn't end with a new line, it's not a text file according to POSIX.
IntelliJ has an option for this:
File → Settings → Editor → General → Ensure every saved file ends with a line break