For historical reasons, the line breaks of the text file on windows and Linux are different.
Windows At the time of line break, carriage return is used at the same time CR(carriage-return character) and line breaks LF (linefeed character)
Mac and Linux only use the newline character LF
Old version of Mac uses carriage return CR
Therefore, there will be incompatibility problems when text files are created and used in different systems.
This happened to me because I'm on a Windows computer, but the code was generated on a Mac or Linux computer.
With the present change, Prettier will try to determine the appropriate line ending style (e.g., LF or CRLF) based on the current file or the environment. It helps maintain consistent line endings across different platforms and operating systems.
I hope this helps making contributing to the project from Windows easier.
Pull-Request Checklist
[x] Code is up-to-date with the main branch
[x] npm run lint passes with this change
[x] npm run test passes with this change
[ ] This pull request links relevant issues as Fixes #0000
[ ] There are new or updated unit tests validating the change
[ ] Documentation has been updated to reflect this change
Description of change
For historical reasons, the line breaks of the text file on windows and Linux are different.
Therefore, there will be incompatibility problems when text files are created and used in different systems.
This happened to me because I'm on a Windows computer, but the code was generated on a Mac or Linux computer.
With the present change, Prettier will try to determine the appropriate line ending style (e.g., LF or CRLF) based on the current file or the environment. It helps maintain consistent line endings across different platforms and operating systems.
I hope this helps making contributing to the project from Windows easier.
Pull-Request Checklist
main
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000