') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Add the global editorconfig CRLF default by ptr727 · Pull Request #242 · ptr727/LanguageTags · GitHub
Skip to content

Add the global editorconfig CRLF default - #242

Merged
ptr727 merged 4 commits into
developfrom
feature/editorconfig-global-eol
Jul 5, 2026
Merged

Add the global editorconfig CRLF default#242
ptr727 merged 4 commits into
developfrom
feature/editorconfig-global-eol

Conversation

@ptr727

Copy link
Copy Markdown
Owner

Adds end_of_line = crlf to the .editorconfig[*] block so every file type has a defined ending (matching the fleet template) instead of the per-extension-only form. Per-type CRLF rules and .gitattributes LF pins unchanged.

Resolves the recurring line-ending drift from the ProjectTemplate audit (reports/languagetags/audit.md), via the audit convergence pattern (AUDIT.md section 10).

🤖 Generated with Claude Code

Set end_of_line = crlf on the [*] block so every file type has a defined ending, matching the fleet template. Per-type CRLF rules and .gitattributes LF pins unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 5, 2026 17:08

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request standardizes line-ending governance by setting a repository-wide default of end_of_line = crlf in the .editorconfig[*] section, so all file types have an explicit baseline line-ending policy while preserving existing per-pattern overrides (e.g., *.sh and Dockerfiles remain lf).

Changes:

  • Add end_of_line = crlf to the .editorconfig global [*] defaults block.
  • Keep existing per-file-type overrides intact (notably *.sh and Dockerfiles pinned to lf).

The global [*] end_of_line = crlf also matches the extensionless .husky/pre-commit hook (must stay LF) and the downloaded LanguageData/* files (a mix of LF/CRLF that must persist byte-for-byte). Add an LF override for the hook (aligned with .gitattributes) and end_of_line = unset for LanguageData so the editor does not normalize the source data.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread.editorconfig Outdated
The [*] defaults (insert_final_newline, trim_trailing_whitespace, charset) still applied to the downloaded LanguageData/* files after only unsetting end_of_line, and any of them can mutate byte-sensitive source data. Unset charset/end_of_line and set insert_final_newline/trim_trailing_whitespace = false so the editor preserves the source bytes exactly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread.editorconfig Outdated
Move the LanguageData/* byte-preservation block above the '.NET-only below' separator, alongside the other line-ending rules, instead of at the file end in the .NET-style section.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Pieter Viljoen <ptr727@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit eafdc6e into developJul 5, 2026
11 checks passed
@ptr727
ptr727 deleted the feature/editorconfig-global-eol branch July 5, 2026 20:42
ptr727 added a commit that referenced this pull request Aug 29, 2026
Adopts the hub's current .editorconfig / .gitattributes / .editorconfig-checker.json
shape: [*] end_of_line = lf with CRLF pinned only for *.bat/*.cmd (Windows requires
it), and git-level text=auto eol=lf normalization to match. This repo's own CRLF
default (PR #242) matched the fleet template as it stood in July; the hub has since
flipped its own default to LF, and the line-ending policy keeps release repos on
the fleet LF default (no operational-repo override applies here). LanguageData/
stays byte-preserved via an explicit .gitattributes pin, since the prior '* -text'
repo-wide default no longer covers it. Renormalizes every tracked file's line
endings to match (content unchanged, verified with --ignore-cr-at-eol); updates the
two docs that described the old CRLF default.
Also fixes the five codegen data-file emitters (Iso6392Data, Iso6393Data,
Rfc5646Data, UnM49Data, LanguageSchema's JsonSourceGenerationOptions), which
hardcoded a CRLF NewLine to match the old default. Left as-is, regenerating any
*DataGen.cs or LanguageData/*.json locally would emit CRLF and either fail
editorconfig-checker or drift from the codegen-drift CI gate under the new LF
default. Regenerates and commits LanguageData/*.json offline (--skip-download) to
match, verified content-identical (--ignore-cr-at-eol).
ptr727 added a commit that referenced this pull request Aug 29, 2026
Converges this repo's line-ending policy with the hub
(`ptr727/ProjectTemplate`). The hub's `.editorconfig`/`.gitattributes`
default flipped from CRLF to LF after this repo's own CRLF default was
added (PR #242, matching what the hub carried at the time). The fleet's
line-ending policy keeps `release` repos on the fleet LF default; no
`operational`-repo override applies here.
- `.editorconfig`: `[*] end_of_line = lf`, CRLF pinned only for
`*.bat`/`*.cmd` (the one type Windows requires it for). Drops the
now-redundant per-type CRLF/LF overrides that existed only to work
around the old CRLF default.
- `.gitattributes`: `* text=auto eol=lf`, CRLF pinned for
`*.bat`/`*.cmd`. `LanguageData/` (downloaded source data the parser
reads byte-for-byte) gets an explicit `-text` pin, since the prior
repo-wide `* -text` default no longer covers it.
- `.editorconfig-checker.json`: carries the hub's added `Exclude` block
(inert in this pure-.NET repo).
- Renormalizes every tracked file's line endings to match (content
unchanged; verified with `git diff --ignore-cr-at-eol` against the
parent commit).
- Fixes the four codegen data-file emitters (`Iso6392Data`,
`Iso6393Data`, `Rfc5646Data`, `UnM49Data`), which hardcoded
`StreamWriter NewLine = "\r\n"` to match the old CRLF default. Left
as-is, regenerating any `*DataGen.cs` locally would emit CRLF and fail
`editorconfig-checker` under the new LF default.
- Updates `OPERATIONS.md` and `WORKFLOW.md`, the only two docs that
described the old CRLF default.
Verified: `dotnet build` and `dotnet test` both clean (310/310 passing),
zero content diff outside the five intentionally-edited files.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Standardized repository text files and generated source files to use
LF line endings for consistent cross-platform handling.
- Preserved CRLF formatting for Windows batch and command scripts.
- Normalized structured data formatting without changing its content or
behavior.
- **Documentation**
- Improved formatting and readability across repository documentation
without changing its content.
- **Chores**
- Updated formatting guidance and editor settings while preserving
existing project, build, and tool configurations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ptr727