DEV Community

Discussion on: Migrating and configuring Eslint with Angular 11

Collapse
 
julienb37 profile image
Julien BONNET

Thanks for this, it was interesting. But but i don't understand a thing : what is the advantage using Prettier when every options are present in ESlint ??

Collapse
 
gsarciotto profile image
Giovanni Sarciotto

Yes, ESLint has a lot of styling options, however I prefer to use Prettier for 2 reasons:

  1. ESLint is a linter, therefore its main job is to analyze code to find errors, potential bugs and code structure (not style, i.e big functions/classes) not conforming to some standard. Prettier is a formatter, therefore its only job is to format the code. I prefer this logic separation. If you have extremely customized linting rules, it can be hard to find the styles rules if they are in the same logic unit (in the .eslintrc), you can workaround this by using a separate .eslintrc file just for your style rules but I don't like it.

  2. The main reason though is because Prettier is opinionated and have some pretty strong defaults, you don't actually need to configure Prettier if you don't want to and it will work just fine.

Collapse
 
julienb37 profile image
Julien BONNET

hmm ... i understand. Thank you