From bd23faa28f6d781581a33d5b780f4b33f7e2cd8b Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Mon, 3 Jan 2022 21:28:24 +0100 Subject: [PATCH] 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. --- .eslintrc.js | 2 +- .gitattributes | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.eslintrc.js b/.eslintrc.js index dd56b077..2dc335df 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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', { diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..e6be08df --- /dev/null +++ b/.gitattributes @@ -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 \ No newline at end of file