Formatter on Windows uses LF line endings

I’ve recently started using the formatter on my code (mix format). I am using Windows for development.

However, the formatter always replaces CRLF with LF, which causes problems with Git (since Git uses autocrlf ). Is there any way of configuring the formatter to respect the Windows line endings? Or are LF line endings part of the “formattting rules”, and should I really convert all my files to LF?

I would do everything possible to convert and ensure your files are LF on disk.

As someone who uses Windows and WSL and happens to have course material, CRLF is such a nuisance for folks who haven’t configured their editors to write files out with LF line endings. Especially if you use Docker. If you happen to have an entrypoint script that has CRLF endings, you’ll get all sorts of fun and non-obvious shell related error messages.

Most editors have options to ensure LF endings are saved and there’s command line tools like dos2unix that you can use to convert existing CRLF files.

4 Likes

Thanks, I see that this is the easiest option.