(linebreak-style)预期的换行符为'LF'但找到'CRLF'.(eslint)

Hap*_*888 8 unix windows lint webstorm eslint

运行lint测试时出现此错误,如何解决此错误:

(linebreak-style) Expected linebreaks to be 'LF' but found 'CRLF'. (eslint)

在此输入图像描述

PS:也许它会有所帮助:我正在使用Windows(WebStorm),该项目正在Debian中运行和调试.

Hap*_*888 12

主要的解决方案是Windows默认使用CRLF,就像我的WebStorm一样.

1)第一步是改变WebStorm默认编码,如:

https://www.jetbrains.com/phpstorm/help/configuring-line-separators.html

2)并在状态栏上更改它

https://www.jetbrains.com/phpstorm/help/status-bar.html

保存!和

OKAY No lint warnings.


Sah*_*gar 9

在您的终端或 cmd 提示符中运行它

git config core.autocrlf false
git rm --cached -r .
git reset --hard
Run Code Online (Sandbox Code Playgroud)

注意 - 确保您没有任何未提交的更改,否则它将被删除!