prettier 与 eslint 对比

Linters have two categories of rules:

代码修正一般有两种规则:

 

Formatting rules: eg: max-lenno-mixed-spaces-and-tabskeyword-spacingcomma-style...

格式化规则,例如:最大长,不允许空格和tab混合,关键字的spacing,冒号风格...

 

Prettier alleviates the need for this whole category of rules! Prettier is going to reprint the entire program from scratch in a consistent way, so it's not possible for the programmer to make a mistake there anymore :)

prettier就是做这个的,prettier会将整个项目保持在一个统一的风格。

 

Code-quality rules: eg no-unused-varsno-extra-bindno-implicit-globalsprefer-promise-reject-errors...

Prettier does nothing to help with those kind of rules. They are also the most important ones provided by linters as they are likely to catch real bugs with your code!

代码质量规则,例如:不能有未使用的变量,不能有无意义的bind,不能隐式定义全局变量,不能在promise中reject()空值

prettier不管这些,这些是更适合交给linter(eslint) 来做的。

 

转载于:https://www.cnblogs.com/eret9616/p/10158726.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值