jprichardson / tin

Easily manage package.json, component.json, and bower.json files.
MIT License
92 stars 4 forks source link

Tin doesn't preserve line break at eof #13

Closed mourner closed 10 years ago

mourner commented 10 years ago

Git, GitHub and many conventions generally recommend having a line break at the end of file. When you run tin, it doesn't preserve line breaks that already present, so e.g. if I have a package.json with \n at eof, it will be removed.

jprichardson commented 10 years ago

Hmm. I've never considered this. It seems rather trivial and inconsequential though. I'll leave this issue open for awhile and see if others feel similarly.

mourner commented 10 years ago

Some background: http://robots.thoughtbot.com/no-newline-at-end-of-file

jprichardson commented 10 years ago

After being in this field for so long, I wasn't aware of this expectation or convention. I thought it was just a nitpicky preference, much like the difference between 2 space indentation or 4 space. You've convinced me. Another discussion: http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline

So it seems to me that in all cases, it should be terminated with a \n. Right?

mourner commented 10 years ago

I think so, but the issue here is not as much about adhering to conventions as it is about not breaking existing conventions in the project. E.g. npm init creates package.json with a new line at eof, and I think it will also add one when rewriting the file when you do install --save.

mourner commented 10 years ago

Thanks!