Search code examples
prettier

How to stop Prettier from removing ending newline


This is a weird one as everything I have read seems to indicated the opposite, that Prettier will always add a newline and there's nothing the user can do about this.

However, somehow my install of Prettier does the opposite. I save a file with a new line ending and exit. Running yarn prettier 'src/**' --write shows that this new line then gets removed in my file.

I'm not running any sort of automatic code formatting tools, so this isn't my editor or anything. I just use a plain Vim install.

This is really frustrating as I do need those new lines but have to avoid using Prettier as it removes them for some reason.


Solution

  • I guess it doesn't remove the newlines, even though I can't find a single tool that actually displays it properly.

    I am seeing the $ as mentioned in this comment which seems to mean it's working.