1

I've created a Node.js module which I'm gonna be open-sourcing soon. I originally developed it on Linux and I decided to test it on Windows before publishing it. When I ran ESLint on Windows I noticed I had a huge amount of linting errors which were all the same:

error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

I read in a couple of places that these linebreaks were inserted by Git when I cloned the repo on Windows. I also read that it is possible to turn off this rule in the eslint config file. Is it safe to do this? or is there a "best practice" regarding this rule? (considering this will be an open source project and hopefully others will be contributing to it)

Any advice or feedback will be appreciated.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I believe Git has some options to deal with this (i.e., to handle it prior to linting). See [this question](https://stackoverflow.com/questions/10418975/how-to-change-line-ending-settings). – nnnnnn Sep 14 '17 at 03:08

1 Answers1

2

Try to re-clone your repo after typing:

git config --global core.autocrlf false

That should avoid Git converting your eol (end of lines) from LF to CRLF automatically on checkout.
Then your linter should find the expected eol.

Note: I have been advocating for that setting to be false by default for years: see "Git: Unix or DOS line termination".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250