DEV Community

Discussion on: Why I Hate ESLint (and How I Learned to Love It)

Collapse
 
davidshortman profile image
David • Edited

Great analysis of what makes linting good and bad!

There’s a piece of the puzzle that I think would solve some of your annoyances with linting, which is “prettification” tooling.

With eslint, for example, my team has a precommit hook that formats the code on your behalf using the “fix” option of eslint. Many of us also have our IDEs set to auto-fix files as we Save. We’ve also used Prettier to the same effect (and have configured it as part of the eslint rules which are auto fixed).

So with your comma problem, for example, a developer may write an enum a certain way, but the moment they save or commit, it would be fixed, avoiding any build failures.

Collapse
 
bytebodger profile image
Adam Nathaniel Davis

Thanks for the feedback! And you make an excellent point. When I wrote that article (about a year ago now) I wasn't as "all-in" on my own IDE's automatic code-formatting tools. But I've recently been doing pretty much what you're suggesting. I kinda write my code however I prefer. And then, when I save/commit it, it just gets reverted back to whatever's the "accepted" style.