feat: enforce LF line endings everywhere

Contributors who work on Windows might accidentally commit newly
created files with CRLF line endings, later causing noisy diffs
when Linux developers work on the same files and they do not have
`core.autocrlf = true`.
However nowadays, most text editors work with LF line endings just
fine on windows, so there's no need for this incompatibility.

Add an `.editorconfig` file which causes the text editor to create
new files using LF from the get-go instead of CRLF (VSCode needs
https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
in order to conform).

Add a `.gitattributes` file to tell git to always checkout files using
LF as line ending.

Normalize line endings throughout the codebase using
`git add --renormalize .`.

https://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/
https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings
This commit is contained in:
Alex Todoran 2025-03-08 08:54:26 +01:00 committed by Elijah Potter
parent f72dcd3ef2
commit 00998a1df4
3 changed files with 49 additions and 44 deletions

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
root = true
[*]
end_of_line = lf

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text=auto eol=lf