How to Fix eslint linebreak style error on Visual Studio Code Windows? (Expected linebreaks to be ‘crlf’ but found ‘lf’)


Suddenly, you run npm run lint and it shows quite a lot of linebreak-style errors. Your Visual Studio Code suddenly does not show you the lint errors as well. You probably run npm run lint — –fix but that will touch tons of the files with linebreaks changed from LF to CRLF – probably not something you want.

How to Fix the eslint linbreak style errors?

First, you run the following command to verify that this fix is good for you:

1
git config -l | grep autocrlf
git config -l | grep autocrlf

What you will see is core.autocrlf=false which isn’t right. You can fix this by:

1
git config --add core.autocrlf true
git config --add core.autocrlf true

Then, you need to clean the cache files of your git repository, you can do this by the following two commands (make sure you stage or commit your changes):

1
2
git rm --cached -r .
git reset --hard
git rm --cached -r .
git reset --hard

Then, it is probably a good idea to re-install your eslint extension (plugin) in your VS code and restart your Visual Studio Code IDE if necessary.

You’ll see the eslint pointing out unnecessary spaces or missing semicolons in your Javascript code again!

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
269 words
Last Post: How to Construct the Maximum Binary Tree using Divide-and-Conquer Recursion Algorithm?
Next Post: How to Compute the Middle of the Linked List using Fast and Slow Pointer?

The Permanent URL is: How to Fix eslint linebreak style error on Visual Studio Code Windows? (Expected linebreaks to be ‘crlf’ but found ‘lf’)

Leave a Reply