码迷,mamicode.com
首页 > 其他好文 > 详细

prettier 与 eslint 对比

时间:2018-12-21 21:10:51      阅读:514      评论:0      收藏:0      [点我收藏+]

标签:form   rom   important   print   最大   ram   doc   使用   格式   

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) 来做的。

 

prettier 与 eslint 对比

标签:form   rom   important   print   最大   ram   doc   使用   格式   

原文地址:https://www.cnblogs.com/eret9616/p/10158726.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!