DEV Community

Cover image for ESLint vs Prettier: The Great Debate for Your Codebase

ESLint vs Prettier: The Great Debate for Your Codebase

Athreya aka Maneshwar on January 15, 2025

Let’s face it: JavaScript and TypeScript developers love to argue about tools. Tabs or spaces? Semicolons or not? And now, the age-old (in JavaSc...
Collapse
 
jankapunkt profile image
Jan Küster 🔥

There is also Biome if you want both in one tool

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

Will check it out

Collapse
 
perisicnikola37 profile image
Nikola Perišić • Edited

Good article.
I think the best option is to implement automatic run of prettier and eslint with Husky.

By doing this, with each commit, you ensure that you have formatted and error-less code pushed to the remote codebase.

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

Thankyou :)

Yes, Husky is just great, forgot to mention it in the article, I've also got a few pre-commit hooks set.

Collapse
 
ansellmaximilian profile image
Ansell Maximilian

Thanks for sharing!

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

:)

Collapse
 
grantdotdev profile image
Grant Riordan

Mod: Nice useful article - I think you make a great point about picking what is right for you. I think too many times in development teams try and fit their project to a mould or what is “the right” way to do something but this doesn’t always mean the “best” way for your team.

Collapse
 
lovestaco profile image
Athreya aka Maneshwar • Edited

Thank you :)

Collapse
 
hkp22 profile image
Harish Kumar

Great article! 🎉 ESLint and Prettier are invaluable tools for maintaining a clean, consistent, professional codebase. They help catch errors early and ensure that your team follows the same coding style, which is a big win for collaboration.

For anyone who wants to take their setup to the next level, I’ve created a couple of tutorials that you might find useful:

1️⃣ ESLint, Prettier, and VSCode Setup for JavaScript Code Linting & Formatting – This video walks you through setting up ESLint and Prettier with VSCode, helping you streamline your JavaScript code linting and formatting workflow.

2️⃣ Git Hooks + Husky + Lint-Staged = Automate code linting & formatting – Here, I show how to set up Git Hooks with Husky and Lint-Staged to automate linting and formatting every time you commit your code.

These tools, when combined, can supercharge your development process and make your codebase more robust and easier to maintain. I’d love to hear your thoughts or any additional tips you might have! 🚀

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

Thanks for the share :)

Collapse
 
keyru_nasirusman profile image
keyru Nasir Usman

This is very nice artice👌
I can code without prettier but I don't feel safe when I am coding without ESLint. I use both but if i have to choose one, i will go with ESLint.

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

Thank you :)

Collapse
 
rcls profile image
OssiDev

These days I often grab Biome instead of these two separate tools that I have to configure differently.

Collapse
 
peshale_07 profile image
Peshal Bhardwaj

Great.

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

Thanks

Collapse
 
tomasdevs profile image
Tomas Stveracek

Nice read! I like how you broke down the topic—it’s helpful for anyone deciding how to set up their codebase. Thanks for sharing!

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

Thanks a lot :)