Conversation
|
Is the plan to visualize end of line in every snapshot? Shall most of the test files be turned to LF for consistency? It’d be great if Prettier repo could follow |
|
Some initial thoughts:
|
|
Seems like Azure Pipelines didn’t run for some reason. |
Jest simply kills all CRs in snapshots – see its
I believe it should be Ideally, all files on all operating systems should be checked-out with identical line endings, regardless of |
|
@j-f1 Its message looks confusing but it actually works, you need to click it to see the detail logs.
I meant, the CRLF/LF checks are done in |
|
Or maybe we should use |
|
IMO we can use |
azure-pipelines.yml
Outdated
| - template: .azure-pipelines/dev.yml | ||
|
|
||
| # There're issues for unicode on Windows build | ||
| # https://github.com/Microsoft/azure-pipelines-tasks/issues/8534 |
|
Based on #5498 (comment), it seems we should revert 38bfa05, but I'm not sure how to deal with those bad unicode. Should we use |
|
copied a couple of comments from #5498 as asked by @ikatyang
Testing on Windows machines with globally configured CRLF and LF in git is what I meant. This can be useful because Windows folks have different preferencess and all of them should be able to contribute to Prettier without problems of running local tests. By default, git’s core.autocrlf is true, but some devs set it to false, e.g. create-react-app contribution guidelines recommend doing so. I did not know Azure pipelines had a flag for CRLF, interesting! Running tests on a Windows machine with LF ia different than doing this on Linux, because on Windows |
|
Updated the OP to reflect the changes, ready for review. |


rangeStart,cursorOffset, etc.) are recalculated if there're CRs.\nwithoptions.endOfLinebeforeprintDocToStringifoptions.endOfLineis notlfformatRange: end of lines are normalized now even if it's not in the range. This is the side effect that we need to normalize eol before parsing butformatRangeneeds AST to calculate the range:prettier/src/main/core.js
Lines 173 to 181 in 6ee2f46
TEST_CRLFto test CRLF by replacingLFwithCRLFbefore formatting (enabled on Windows CI)tests/)docs/directory)✨Try the playground for this PR✨