I'm using Sublime Text 3 and want to ensure I get only a single new line at the end of a file on save. At the moment, 90% of the time my whitespace works perfectly, using:
"ensure_newline_at_eof_on_save": true
and
"trim_trailing_white_space_on_save": true
... however, every once in a while the file saves with two new lines at the end of the file.
This appears to occur when there is white space on the final newline prior to save, with the config settings adding a newline, then deleting the whitespace. Changing the order of these settings in config doesn't resolve this.
I haven't been able to find other reasons of this, so it may well be the only cause, though ideally I'd like to check if there's ever more than one newline on save.
The environment I'm working in fails its tests unless a file has exactly one new line at its end, so this is a bit of a pain. My question is whether there's a plugin / way to be stricter on save, ensuring one and only one trailing new line.