What is the best thinking on this matter?
Ask HN: Should source files always end in a new line?
1–10 of 40 posts
Re: Ask HN: Should source files always end in a new line?
#2[deleted]
Re: Ask HN: Should source files always end in a new line?
#3Yes please, even if there's no need for a final newline just do it.
Re: Ask HN: Should source files always end in a new line?
#4Consistency is king - yes. Newline at EOF, trim trailing whitespace.
Re: Ask HN: Should source files always end in a new line?
#5I'd prefer it, as would most?
Re: Ask HN: Should source files always end in a new line?
#6Pro: ???
Con: Your file is 1 byte larger.
Re: Ask HN: Should source files always end in a new line?
#7I say yes, whatever the plain-text content it is.
Re: Ask HN: Should source files always end in a new line?
#8The only difference I can think of is when appending to a file.
Starting with an empty file you’re on a new line.
But if you don’t end every line with a newline character then your next line will end up on the same line in the file as the last one.
Re: Ask HN: Should source files always end in a new line?
#9This doesn't matter even remotely and it is the height of bike shedding to even have a discussion about it.
Re: Ask HN: Should source files always end in a new line?
#10POSIX text files have lines terminated in a newline and so the POSIX text files always end in a newline.
Source files are text files so they end in a new line.