DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

eslint vs prettier vs editorconfig, or just use everything?

Formatting on save is very handy.

Top comments (3)

Collapse
 
rffaguiar profile image
Renan Aguiar

Everything I would say.

Eslint is a linter for your code, it looks for errors.

Prettier is a code formatter, it doesn't look for errors. It makes your code looks "formatted" across the entire codebase.

Editor config may be using eslint + prettier under the hood.

For example, on your code editor you just use the regular editor config (which uses prettier and eslint under the hood). You could create a npm script that run eslint and prettier before pushing to a repo for example.

husky would help you to achieve this. It adds hooks to your developer environment to run certain scripts when something happens. On this case: "When I run git push do npm run estlint-prettier".

Collapse
 
chakrihacker profile image
Subramanya Chakravarthy

I prefer prettier and editorconfig as both of them doesn't need much thought and set rules for us. Coming to eslint, I have to use in company projects, but for personal projects I don't add this extra thing

Collapse
 
martini profile image
Martin

I personally use ESLint. It covers the code style, and you have a wide variety of options (and plugins + their options) to customize what you want. This works fine for me as I have it fix my code on save.