* Towards changing default value for endOfLine * Update tests and snapshots * Add placeholder for changelog_unreleased * Add CHANGELOG * Undo adding snapshot tests for auto as it does not play well on Windows in CI * Tweak changelog * Update jest snapshot
1.7 KiB
Change default value for endOfLine to lf (#7435 by @kachkaev)
Early versions of Prettier were formatting all files with the *nix flavor of line endings (\n, also known as LF).
This behavior was changed in #472, which allowed preserving Windows line endings (\r\n, also known as CRLF).
Since Prettier version 1.15, the flavor of line endings is configurable via the endOfLine option.
The default value was set to auto for backwards compatibility, which meant that Prettier preserved a flavor of line endings already present in a given file.
With endOfLine equal to auto, Prettier converted mixed line endings within one file to what was found at the end of the first line.
However, line endings in neighboring files could still remain inconsistent.
Besides, contributors on different operating systems could accidentally change line endings in previously committed files and this would be fine with Prettier.
Doing so would produce a large git diff and thus make the line-by-line history for a file (git blame) harder to explore.
You are encouraged to use the new default value for endOfLine, which is now lf.
It may be also worth checking the option docs to ensure your project repository is configured correctly.
This will help you avoid a mix of line endings in the repo and a broken git blame.
If the old behavior is still preferred, please configure Prettier with { "endOfLine": "auto" }.