I have read several explainers and I still don't understand the different between linting and formatting - or rather, I understand, but I don't know why you'd run a linter and then a formatter.

Isn't a formatter basically a linter that fixes the problems that linting catches?

@shauna Far as I understand, the purposes overlap but neither is a subset of the other: a linter might identify problems that cannot be resolved automatically, but doesn't fix anything). So a linter has a bigger detection scope but no fixing capability, and a formatter has a fixing capability but a smaller detection scope.

And then some tools are (or can be) both, and then on top of *that* the terms are used semi-interchangeably depending on what a tool looks like it's made for aesthetically.

(Edited and reposted because my original description really wasn't very clear at all either)

@joepie91 this makes sense! so if you're configuring both for a project, you'd probably run the formatter first to fix what can be fixed automatically, then the linter to fix everything else?

Follow

@shauna That's my understanding, yep. Or alternatively use a tool that can do both in one pass - ESLint would be one example of that, although I'm not sure how far its auto-formatting capabilities reach so it *may* not be the best example.

(Assuming that enforcing consistent formatting is desirable for the project in the first place, of course - as that's often a topic of discussion)

· · Web · 0 · 0 · 0
Sign in to participate in the conversation
Pixietown

Small server part of the pixie.town infrastructure. Registration is closed.