DEV Community

Discussion on: Setup ESLINT and PRETTIER in React app

Collapse
 
nzxt profile image
Deniz True

Thanks for the good manual!
Could you clarify, please, what is the real profit of using prettier? What prettier does that eslint does not. I'm using eslint without prettier connected for a long time and it covers all our formatting needs. I see the notice, that prettier is optional. So is it really worth it to install one more additional package?

Collapse
 
knowankit profile image
Ankit Kumar • Edited

⭐️ This is a very good question. I know the answer for it and I am writing one small article on this and I will post the link once done. Thanks for dropping by.

Collapse
 
cassiorsfreitas profile image
Cássio Freitas
  • ESLint: underline when code doesn’t comply to logical rules. Can run a script and fix some easy errors (etc. unused variables lying around)
  • Prettier: doesn’t change the logic of code, only formats it (etc. removing extra spaces, turning double quotes to singles)
Collapse
 
blindfish3 profile image
Ben Calder

This is probably considered necromancy; but seeing as you didn't get a complete answer and for the benefit of others:
Prettier is particularly useful when working in teams. If each person has a subtly different coding style, then simple changes in formatting can result in a change registered in a commit that doesn't affect the logic itself. That adds unnecessary noise to commits. Prettier avoids this by enforcing agreed formatting patterns.
You then have confidence that when reviewing commits - e.g. during code review or bug-fixing - you're seeing changes to logic and not formatting.