DEV Community

Cover image for How to make ESLint work with Prettier avoiding conflicts and problems

How to make ESLint work with Prettier avoiding conflicts and problems

Raffaele Pizzari on September 25, 2020

(check out my blog) Having prettier and ESLint up and running on your project can be very useful and can save us a lot of time by identifying stat...
Collapse
 
amatana profile image
Ana Amat

Loved it, it was very easy to follow and friendly.
I just had a problem when adding the "prettier/prettier" : "error", inside the rules at the .eslintrc file. It caused many errors that wouldnt allow the app to compile.
I took it and all went again smoothly. Any comments?
Questions are:

  • What does the "prettier/prettier" rule means?
  • The most secure way to ensure a proper work among ESlint & Prettier is to install both eslint-plugin-prettier and eslint-config-prettier dev dependencies? Right?

Appreciatte your answer!
Thank you!

Collapse
 
fyfirman profile image
Firmansyah Yanuar

You saved me! I was annoyed when i format my code with ALT+SHIFT+F in my vscode that formatting to Prettier rules and when saving my files it execute ESLint and prettier give me a warning. Now i just set my ALT+SHIFT+F to ESLint cause it will formatting to Prettier too.

ANW, if anyone occurred this problem in ESLint console:

Request textDocument/formatting failed with message: Cannot find module 'prettier'
Require stack:
...
Enter fullscreen mode Exit fullscreen mode

Dont forget to install prettier ( yarn add -D prettier )

Collapse
 
zodman profile image
Andres 🐍 in 🇨🇦

you missing the eslint --fix <file>

Collapse
 
ravgeetdhillon profile image
Ravgeet Dhillon

Well Written and to the point.

Collapse
 
jvarness profile image
Jake Varness

Super helpful for folks using two really popular dev tools. Good write-up!

Collapse
 
pixari profile image
Raffaele Pizzari

Thank you very much! :)

Collapse
 
jilvanx profile image
Jilvan Cândido

Very helpful this article. Congratulations buddy!

Collapse
 
jazzdev profile image
Taiwo Jazz

Thanks a lot man

Collapse
 
theagols profile image
Thiago Lourenço

Really helpful post. I was having a hard time with these two. Thank you!

Collapse
 
karlpihlakas profile image
Karlp

amazing!

Collapse
 
trungnhan profile image
Trung Nhan Le Nguyen

amazing, i have tried many ways but not working until now. Tks so much