Fix: enforce LF line endings to resolve prettier errors on Windows#1990
Fix: enforce LF line endings to resolve prettier errors on Windows#1990Kayd-06 wants to merge 2 commits intoopenstreetmap:mainfrom
Conversation
|
if band aid for bad OSes is needed, maybe something as simple as would be sufficient and work? What is the benefit of listing file types? (idea taken from https://stackoverflow.com/questions/26075786/force-lf-line-endings-using-gitattributes-without-losing-automatic-text-binary - as I have no access to Windows I am unable to test it, but if I read https://git-scm.com/docs/gitattributes#_end_of_line_conversion correctly it should work well) |
|
🍱 Your pull request preview is ready Please use this preview to check your changes. Ideally use the test documentation template and document your test results by commenting on the PR. This will speed up the review process for everyone. FYI, once this PR is merged, you can use the iD Editor Preview to test your changes in interaction with all other changes. |
|
Yes, using just |
|
BTW, if I remember right you can set this also as system-wide default in your git settings on global configuration in your computer. But I guess that adding such Windows-proofing here may make sense? |
matkoniecz
left a comment
There was a problem hiding this comment.
does not break anything on Linux, reportedly unbreaks Windows, looks safe to me
Description
When checking out this repository on a Windows machine (which typically defaults to
core.autocrlf=true), Git checks out files with Carriage Return Line Feed (CRLF) line endings. However,prettierenforces Line Feed (LF) endings (via.prettierrc). This mismatch causesnpm run lintto fail out-of-the-box on Windows with thousands of formatting warnings.To prevent this error and guarantee consistent file endings across all operating systems, I added a
.gitattributesfile to enforceLFfor text files.