New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create .gitattributes #3760
Create .gitattributes #3760
Conversation
This .gitattributes file will force Windows developers to check out LF line endings instead of the default "auto" behavior (CRLF check out, LF check in). This is a quality-of-life improvement for Windows developers, who will otherwise need to manually fix line endings after forking the repository in order to avoid ESLint (prettier/prettier) line ending errors ("Remove CR"). References: https://git-scm.com/docs/gitattributes#_end_of_line_conversion https://dev.to/deadlybyte/please-add-gitattributes-to-your-git-repository-1jld#gitattributes-reset
Codecov Report
@@ Coverage Diff @@
## master #3760 +/- ##
=======================================
Coverage 93.34% 93.34%
=======================================
Files 178 178
Lines 1849 1849
Branches 332 332
=======================================
Hits 1726 1726
Misses 105 105
Partials 18 18 Continue to review full report at Codecov.
|
Hey thanks! I don't know much about this stuff — what would be the difference between what you've suggested here and what React does for example? |
Comparison with React .gitattributes fileHey thanks @adamwathan and @danny007in 😀 So that Facebook example (facebook/react@8abca77) is actually the default behavior for Git repositories hosted at GitHub, which means their That confused the **** out of me, but all that happens is:
Current behavior and Windows workflowHere's the current behavior for /tailwindlabs/tailwindcss when I clone it on Windows 10 using GitHub Desktop, after npm install: As you can see, every file has ESLint errors that come from the "prettier/prettier" rule in the That PR won't fix the screenshot issue, though, leaving me two options as a Windows developer:
Effects of this PRMerging this PR (#3760) and adding .gitattributes would mean that I don't get the CR/LF line endings at all, so there is no error. I can't take a screenshot of cloning from my branch, so I duplicated the project into a new Git repo. I published that to GitHub, deleted my local copy, and recloned it from doctorderek/tailwindcss-gitattributes-demo ... followed by npm install : As you can see, I might still have some local errors based on my VS Code settings (in this case, TypeScript warnings), but I pull down on Windows with the correct line endings. Other ways of achieving this PRYou could remove and/or tweak the ESLint rule prettier/prettier, but that seems like a big change to accommodate Windows developers when adding the Hope this explanation helps! Reference"If you want to ensure that text files that any contributor introduces to the repository have their line endings normalized, you can set the text attribute to 'auto' for all files. |
I updated the
The new Windows developers will have LF line endings for text files, meaning they will not see ESLint "prettier/prettier" errors. This improved Comparison with previous
|
Are we going to merge this because I use Windows and the eslint line-break problem is really bugging me. |
I found manually running `eslint . --fix` works OK as a workaround, unless
you want to switch branches.
Or maybe just edit the eslint config file to remove the rule while you're
working on it, then don't commit that change.
Just some thoughts 😊 Those red squiggly lines drive me crazy too haha.
|
Hey @samarmohan I feel you 😀 I think @adamwathan was leaning towards "not merge" but of course it makes sense that this is a low priority for the @tailwindlabs team. This PR is still in fact open, and I've been having good success using a thorough .gitattributes file in my other professional work. |
Hey @DoctorDerek, I really appreciate you taking the time to put this PR together and also thoroughly explaining what it does. And while there is clearly a challenge here for Windows developers, pulling in a 200 line PR like this is a bit scary for us, because it will become our job to maintain it moving forward, and, as you can probably tell, no one on the Tailwind Labs team uses Windows for development. Given that, and since it sounds like you have a viable workaround (thanks for sharing that!), I am going to close this issue. Thanks either way for the contribution and for your interest in Tailwind CSS 💪 |
This .gitattributes file will force Windows developers to check out LF line endings instead of the default "auto" behavior (CRLF check out, LF check in).
This is a quality-of-life improvement for Windows developers, who will otherwise need to manually fix line endings after forking the repository in order to avoid ESLint (prettier/prettier) line ending errors ("Remove CR").
References:
https://git-scm.com/docs/gitattributes#_end_of_line_conversion
https://dev.to/deadlybyte/please-add-gitattributes-to-your-git-repository-1jld#gitattributes-reset