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

WebStorm Ant Design Pro js报错:ESLint : Expected linebreaks to be ‘LF’ but found ‘CRLF’ linebreak-style
解决:

检查.eslinttrc.js是否有配置

/*eslint linebreak-style: ["error", "unix"]*/

Windows下 项目中的 .eslinttrc.js

...
rules: {
    "linebreak-style": [0,"error", "windows"],
    ...
}
...

参考 ESLint文档 linebreak-style :

When developing with a lot of people all having different editors, VCS applications and operating systems it may occur that different line endings are written by either of the mentioned (might especially happen when using the windows and mac versions of SourceTree together).The linebreaks (new lines) used in windows operating system are usually carriage returns (CR) followed by a line feed (LF) making it a carriage return line feed (CRLF) whereas Linux and Unix use a simple line feed (LF). The corresponding control sequences are “\n” (for LF) and “\r\n” for (CRLF).

在使用不同的编辑器、VCS应用程序和操作系统时,使用的换行操作不一样,造成了这种报错

你可能感兴趣的:(pen)