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

Make Prettier preserve line ending type #2244

Merged
merged 2 commits into from May 17, 2021

Conversation

felix-hilden
Copy link
Collaborator

@felix-hilden felix-hilden commented May 17, 2021

Hi! This PR, should you choose to accept it, makes Prettier preserve the line ending types of files it touches.

Why? The default in Prettier 2.0 was changed from auto to LF. This makes development on Windows awkward, because every file is marked with changes both by Prettier and then by Git regardless of repository line ending settings, making committing harder than it should be.

As discussed in #1741, line ending settings can be configured, and there are other tools for enforcing line ending consistency. I don't know whether they have the same effect of converting all files regardless of settings though.

Suggested: skip-news. If this is not to your liking, feel free to close. This PR will self-destruct in five years.


Aside from that: I noticed that runnin pre-commit manually seems to add line endings to symlink files, but they disappear when actually committing. Don't know if that's a known.. quirk..(?) or not.

@JelleZijlstra JelleZijlstra added the skip news Pull requests that don't need a changelog entry. label May 17, 2021
Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Unrelatedly it'd be nice to have our prettier config in a .prettierrc file instead of just in the precommit configuration.

@ichard26
Copy link
Collaborator

side note:

This PR will self-destruct in five years.

uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh 😆

@felix-hilden
Copy link
Collaborator Author

Thanks! It seems that some Mac build is failing, but it's the same as on main.

I'll add the .prettierrc. Actually that sounds like the reason for the symlink line endings changing.

@felix-hilden
Copy link
Collaborator Author

Hmm, the symlinks still toggle, but there you go with the config file at least! I'm happy for now. It's not like running pre-commit manually is absolutely necessary or anything.

@ichard26 ichard26 merged commit 921c24a into psf:main May 17, 2021
@ichard26
Copy link
Collaborator

Thanks much for your contribution! This project is only possible by contributions like these 🖤. You're awesome, @felix-hilden. To be honest, I haven't touched a Windows machine in a long time so I've never seen this as an issue nervous laughter. Also, I've started a new project to improve the contributing experience for this project, so I'd love to hear your feedback and suggestions. More details can be found here: GH-2238.

don't mind me testing out this new manner of saying thanks haha :D

@felix-hilden
Copy link
Collaborator Author

You're most welcome! Yeah I think that's a very nice thank you for any new contributor, albeit a little over the top for my modest Finnish self :D but I know that won't read so sarcastic for other potential contributors 😅 Also, that black heart is a nice touch.

Hmm, I'll have a look at the issue!

@felix-hilden felix-hilden deleted the prettier-eol-auto branch May 17, 2021 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Pull requests that don't need a changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants