Declare LF and final-newline conventions in .editorconfig

Pairs with .gitattributes: eol=lf pins what git produces at checkout;
.editorconfig pins what editors write to disk - the one CRLF vector
git's filters cannot reach (git never rewrites the working tree, so an
editor-written CRLF file would persist with a clean status while the
doc gates misbehave on it). insert_final_newline declares the existing
one-trailing-newline policy (AGENTS.md, gated by git diff --check) at
the editor layer too.

(cherry picked from commit 7a09602fd76efff81a0875fb177289004c3dfc9b)
This commit is contained in:
Huanqi Cao
2026-07-05 17:04:35 +08:00
committed by imccyu
parent d42b118fe3
commit 4cbd722074

8
.editorconfig Normal file
View File

@@ -0,0 +1,8 @@
# Editor-side declaration of the repo's text conventions. Pairs with
# .gitattributes: that file pins what GIT produces (LF checkouts), this one
# pins what EDITORS write to disk — the one path git's filters cannot reach.
root = true
[*]
end_of_line = lf
insert_final_newline = true