DEV Community

Discussion on: Which do you prefer? ESLint or Prettier or both?

Collapse
 
creeland profile image
Cree

I'd say that's a bit like comparing 🍎 to 🍊 since they both accomplish two different things.

👩‍🎨 Prettier is an opinionated formatter that parses the AST and reprints the entire thing, enforcing prettier's style rules, but it doesn't actually make changes to the AST. You'd use prettier to enforce code style across the entire project, it isn't going to catch errors.

👮‍♂️ ESLint traverses the tree and can make changes to nodes and give you warnings. ESLint does have some format opinions but it doesn't reprint your entire tree as prettier does. You'd use ESLint to enforce code convention across your project.