chore: normalize line endings to LF via .gitattributes - #5229
Open
HelloOjasMutreja wants to merge 1 commit into
Open
chore: normalize line endings to LF via .gitattributes#5229HelloOjasMutreja wants to merge 1 commit into
HelloOjasMutreja wants to merge 1 commit into
Conversation
Windows checkouts default to core.autocrlf=true, which converts checked-in LF files to CRLF on disk. Any script that regenerates a checked-in file and diffs it byte-for-byte against freshly-generated content (which Prettier/Node write as LF) then fails on every such machine, regardless of whether the data is actually stale. Confirmed with scripts/generate-cldr-weekdays.mjs --check: it always reported stale data on a default Windows checkout even immediately after running the generator, since the comparison was LF-generated content against a CRLF-checked-out file. Forcing eol=lf for all text files removes the mismatch at the source, for every future checkout.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
HelloOjasMutreja
marked this pull request as ready for review
August 20, 2026 04:57
HelloOjasMutreja
requested review from
cixzhang and
imdreamrunner
as code owners
August 20, 2026 04:57
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.
Not tied to a filed issue; found while shipping an unrelated fix, when
scripts/generate-cldr-weekdays.mjs --check(from the recently-merged Calendar CLDR PR) failed on a completely default Windows checkout, immediately after running the generator itself.Root cause
The check does:
expectedis built from a template literal plus Prettier'sformat(), both of which always emit\n.actualis read exactly as the file sits on disk. Git's defaultcore.autocrlf=trueon Windows converts checked-in LF files to CRLF on checkout, soactualhas CRLF line endings whileexpectedhas LF. The byte-for-byte comparison then fails on every default Windows checkout, regardless of whether the data is actually stale.Confirmed: forcing a fresh LF checkout of the same file (bypassing
autocrlf) makes the exact same check pass immediately, with zero real content difference. This isn't specific to the CLDR script either, it's a latent risk for any current or future script that does a similar regenerate-and-diff check.Fix
Add a
.gitattributesrule forcing LF line endings on checkout for all text files:This is the standard fix for this exact class of problem (also used by many JS/TS monorepos), and normalizes checkouts going forward for every Windows contributor without needing anyone to change their local
core.autocrlf. It doesn't touch any already-committed blob content, only how files are materialized on checkout/add from here on.Verification
node scripts/generate-cldr-weekdays.mjs --checkpasses on a normal checkout. Ran the fullBottomSheetsuite (180 tests) as a sanity check that nothing else regressed; unaffected as expected, since this only changes checkout-time line-ending handling. No changeset since this touches no published package.