How to make IntelliJ IDEA insert a new line at every end of file?

Change your Editor settings:

SettingsEditorGeneralEnsure line feed at file end on Save


For MAC users:

Preferences > Editor > General > Ensure every saved file ends with a line break


IntelliJ IDEA 2016.3

Approach 1

File > Settings... > Editor > General > Ensure line feed at file end on Save

File > Settings

Editor > General > Ensure

Approach 2

Help > Find Action... (Ctrl+Shift+A) > type "Ensure line feed" > switch the toggle to ON (using the mouse click or Enter) for "Other: Ensure line feed at file end on Save" line

Help > Find Action

Ensure line feed