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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM