[mui-codemod] Fix CRLF handling in v6 codemod post-processing#48711
Open
Mohamedb91 wants to merge 4 commits into
Open
[mui-codemod] Fix CRLF handling in v6 codemod post-processing#48711Mohamedb91 wants to merge 4 commits into
Mohamedb91 wants to merge 4 commits into
Conversation
Deploy previewhttps://deploy-preview-48711--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
siriwatknp
approved these changes
Jun 25, 2026
Member
|
Thanks for the fix! |
Author
I can't merge probably because I'm not a maintainer - if possible can you merge? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a Windows-specific issue in the styled-v6, theme-v6, and sx-v6 codemods where extra blank lines are not cleaned up.
The current cleanup logic splits the transformed source by \n. On Windows, the source has \r\n line endings, so splitting by \n leaves a trailing \r on each line. This causes blank lines (which split as \r instead of "") to bypass the line !== '' check, leaving incorrect empty lines in the output.
This fix dynamically detects the line terminator from the transformed source and uses it to split and rejoin the code, fixing the bug on Windows while preserving the original line endings. All codemod tests are now passing on Windows.