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应用程序和操作系统时,使用的换行操作不一样,造成了这种报错

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值