visual studio code install eslint error for LF or CRLF

14.3k views Asked by At

cation:I test js-stack-from-scratch,my OS is windows.When I yarn start,it dead! enter image description here

enter image description here

enter image description here

I know that the line-break-style of OS 'unix' or 'windows' is different, that make the error. but how to deal it? My IDE is VSC. pageage 'gulp-eslint' is yarn add.

1

There are 1 answers

1
Rohit Saxena On BEST ANSWER

There are two ways you can achieve this. In both ways the objective is to change the linebreak style rule for eslint.

  1. Add /*eslint linebreak-style: ["error", "windows"]*/ to the top of your file. This will only remove the error from the specific file you add this code to.

  2. The more long term solution is the modify the code in the eslint.json file of your project. In general from the root of your project, you should find it in the root directory of your project named .eslint.json. Add the following code:

, "rules": { "linebreak-style": 0 }

The comma is for the line above it after the closing bracket of whatever other parameter is in the file.