-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix(sql): printer to handle eol correctly #358
base: master
Are you sure you want to change the base?
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Hello, @JounQin could you review this PR? |
formatted = formatted.replaceAll(/\r\n?|\n/g, ending) | ||
|
||
return formatted.endsWith(ending) ? formatted : formatted + ending | ||
return formatted + '\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't read endOfLine
option at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tested it, EOL doesn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the tests do not cover endOfLine
option which could be different with git source codes.
I have the original document like below (with CRLF eol)
when I set
endOfLine
config tocrlf
than result like belowwhen I debug,
sql printer handle eol correctly, but I can find
\r\n
is replaced by\r\r\n
after return formatted value.actually I didn't find any reference but I guess prettier gives nomalized input as LF and process eol after printer printed.
this patch remove any eol conversion. so, prettier will handle it.