Fix mutated line endings on Windows

It prevents Git from modifying files on checkout. By default, it
converts LF line-endings to CRLF on Windows which leads to inconsistency
and ESLint `linebreak-style` with `unix` (LF) value to fail.

It also solves failed builds in GitHub actions agents actions/checkout#135.
This commit is contained in:
undergroundwires
2022-01-03 21:28:24 +01:00
parent 5b1fbe1e2f
commit bd23faa28f
2 changed files with 7 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ function getOwnRules() {
return {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'linebreak-style': ['error', 'unix'], // Also enforced in .editorconfig
'linebreak-style': ['error', 'unix'], // This is also enforced in .editorconfig and .gitattributes files
'import/order': [ // Enforce strict import order taking account into aliases
'error',
{

6
.gitattributes vendored Normal file
View File

@@ -0,0 +1,6 @@
# Prevent Git from auto-converting to CRLF on Windows, and convert to LF on checkin.
# * : All files
# text=auto : If Git decides content it text, it converts CRLF to LF on checkin.
# eol=lf : forces Git to normalize line endings to LF on checkin and prevents conversion
# to CRLF when the file is checked out.
* text=auto eol=lf