-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add option to enforce certain line endings #5327
Conversation
…to test true presence of \r
… snapshots on Windows
So this is ready to be merged? Maybe we should update the TODO list then.. |
# Conflicts: # tests_integration/__tests__/__snapshots__/support-info.js.snap
Also if this is part of the 1.15 milestone we will have to update the blog post as well! |
Looks like the only thing left to do is to wait for the new version of |
…ion (#4) Partially addresses prettier/prettier#5320. Helps implement prettier/prettier#5327.
Done, you can upgrade to version |
… added in yarn 1.10)
Many thanks for doing this so quickly @josephfrazier! 💯 This PR should be ready for a final review and can be merged after that! @lipis can we squeeze it into 1.15 given that all is done? 😅 |
@ikatyang You're pretty much managing the 1.15 release, I think you can decide to include in this release or not. |
I'd like to wait for a day to see if there's any objection, it will be included in 1.15 if everything goes well. |
… auto,lf,crlf,cr)
After some more thinking, I changed the order of option values both in docs and cli ( @ikatyang if you don't agree with this change, simply chop off my last commit before merging. Let me know if you need help with anything else! |
Don't worry, I'll merge it later. I was fixing regressions. |
Thanks! |
Amazing!!! Many thanks for all your prompt comments and very useful reviews! I'm soooooo glad we could squeeze this feature into 1.15 that I'm jumping through the roof! 😅 |
This PR contains a minimal viable implementation of #5320.
There is also a sidecar PR in another repo to read
.editorconfig
option as suggested by @evilebottnawi. I believe it is ready to be reviewed and can be merged after we close the first item in the TODO list below. We need to release a new version ofeditorconfig-to-prettier
before completing this feature.docs/
directory)TODO (based on reviews)
Agree on the option name:
eol
(originally proposed) – a commonly known abbreviation, but may be confusing for newcomersendOfLine
/--end-of-line
(suggested by two maintainers) – easier for newcomers, but takes longer to write; similar to.editorconfig
'send_of_line
lineEnding(s?)
/--line-ending(s?)
– a commonly used term in human-to-human communicationDecide if we want to support
--endOfLine=cr
at all. I'm not sure if Prettier can successfully parse files withoutLF
at the moment. In any case, onlyCRLF
andLF
are prevalent (I haven’t seen anyone usingCR
only). Discussion: 4th conversation in Add option to enforce certain line endings #5327 (review) (marked as resolved by @ikatyang). Solution: keepcr
amongst values for consistency with what.editorconfig
supports.Merge [WIP] Convert .editorconfig’s end_of_line option to Prettier’s eol option josephfrazier/editorconfig-to-prettier#4 and replace a temporary used fork with the original package.
Looking forward for your thoughts folks 🙌
Future work
eol
for files that have a syntax error don't have a known grammar (e.g..gitignore
). This should make it possible toprettier --write '**/*'
orprettier-check '**/*'
. We can do this in follow-up issues and PRs.