react.dev
react.dev copied to clipboard
fix: implement `.editorconfig` to enforce LF line endings
Hello 😊
For general Windows users, when cloning the react.dev repository, LF
often automatically changes to CRLF
if no special settings are made in the editor. Typically, this changes back to LF
during commits.
However,
- In some cases, due to bugs or conflicts, the conversion back to
LF
does not occur properly. - To prevent
CRLF
automatic conversion on Windows, users must use commands likegit config --global core.autocrlf false
, which is a drawback as it relies on personal settings of the user. - Due to the execution of pre-commit hooks,
CRLF
is changed back toLF
during commits. However, since all file line endings are changed toCRLF
after cloning the repository on Windows, there is a major drawback where all files are marked as modified.
Example of an error situation:
On windows, After adding a comment // add test
to the 404.js
file and entering git commit -m "test"
, all files with CRLF
are changed to LF
, resulting in over 100 files showing changes.
Therefore, to ensure smooth compatibility between Windows and Linux/Mac users, I propose the adoption of .editorconfig
, which is used in various repositories like 'react', 'eslint' and 'prettier'. By enforcing the use of LF
, it is expected that Windows users will experience less confusion due to CRLF
/LF
issues during development.
Furthermore, I would like to tell you that after adopting .editorconfig
, all the above-mentioned errors have been resolved. Thank you for your attention to this matter :)