Linters have two categories of rules:
代碼修正一般有兩種規則:
Formatting rules: eg: max-len, no-mixed-spaces-and-tabs, keyword-spacing, comma-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-vars, no-extra-bind, no-implicit-globals, prefer-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) 來做的。
