Skip to content
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

chore: Create .gitattributes to prevent errors with Prettier in Windows #2288

Merged
merged 2 commits into from
Oct 22, 2023

Conversation

trusktr
Copy link
Member

@trusktr trusktr commented Oct 21, 2023

Summary

It is recommended by Prettier to use LF endings for all files including in Windows, and they officially recommend to set this option in .gitattributes file for consistency, and LF is the default in Prettier 2 or higher. The lack of this file bit me in another project whose build failed in Windows in GitHub Actions due to prettier --check failing in Windows with default LF mode.

More info: prettier/prettier#7825 (comment)

Related issue, if any:

What kind of change does this PR introduce?

Build-related changes
Repo settings

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

No

Tested in the following browsers:

N/A

It is recommended by Prettier to use LF endings for all files including in Windows, and they officially recommend to set this option in .gitattributes file for consistency, and LF is the default in Prettier 2 or higher. The lack of this file bit me in another project whose build failed in Windows in GitHub Actions due to `prettier --check` failing in Windows with default LF mode.

More info: prettier/prettier#7825 (comment)
@vercel
Copy link

vercel bot commented Oct 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2023 1:12am

@trusktr
Copy link
Member Author

trusktr commented Oct 22, 2023

Note, our build was not failing before this change, but without this change, some user's git configuration in Windows (apparently mine) could be different, and CRLF vs LF issues would pop up. Basically we've gotten lucky in our testing so far, and I don't normally dev in Windows so I happened to stumble on this when I tried.

trusktr added a commit to lume/docsify that referenced this pull request Oct 22, 2023
This is a temporary commit until docsifyjs#2288 and docsifyjs#2291 are merged to Docsify develop, so that I can get Lume build working in Windows (which includes Docsify for the docs site)
@sy-records sy-records changed the title Create .gitattributes to prevent errors with Prettier in Windows chore: Create .gitattributes to prevent errors with Prettier in Windows Oct 22, 2023
@sy-records sy-records merged commit 4e8d6df into develop Oct 22, 2023
7 checks passed
@sy-records sy-records deleted the gitattributes-for-prettier branch October 22, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants