Seeking idiomatic.js tool recommendation


Does anybody here know of a tool that will check your code against the idiomatic.js: Principles of Writing Consistent, Idiomatic JavaScript guidelines?

Ideally, the tool would be something like JSLint where you can copy and paste your code and it returns code quality errors.



Have you tried JSLint itself? Quite a bit of stuff in that guide, JSLint does specifically check for.

Other things that guide are frankly silly in their breathless pronunciation. To wit (all boldface is theirs)

Whether you prefer single or double shouldn’t matter, there is no difference in how JavaScript parses them. What ABSOLUTELY MUST be enforced is consistency. Never mix quotes in the same project. Pick one style and stick with it.

Look, consistency is great, but when you say the preference doesn’t matter, the dire shouty tone afterward is just silly. Others, like their style of constructors and accessors actually fly in the face of recommended practice elsewhere. Really, it reads more as a monument to bikeshedding than any well-considered set of guidelines. Style guides are good, everyone should follow one even if they don’t like all of it, but they have to be grounded on some kind of real principles, not groundless and imperious pronouncements.

And it gets worse: later, they recommend using constructs like the thisArg parameter passed by map/reduce/forEach. This extra info is a flagrant violation of encapsulation, and was the result of ill-considered hacks that Mozilla added to those methods, after which objections were raised, but they were baked into the standards when they escaped into the wild and it became too late to change them to more normal behavior. So there’s not only a lot of pointless bikeshedding, there’s objectively bad advice in that guide too.

1 Like

BTW, so as to not just throw rocks, I recommend following the style of Douglas Crockford, the creator of JSLint. The man knows what he’s talking about from many years of experience:

Unfortunately that guide is a little thin, so I recommend reading some of his actual code:

1 Like

This is what my subconscious has been trying to tell me as I have used JSLint before, but I guess I wasn’t listening to it since I was too distracted playing around with the various linters and style guides out there.

idiomatic.js piqued my interest because Kyle Simpson recommended it in one of his courses as a good style guide to start off with if one doesn’t already have a style guide. However, Kyle Simpson does admit he disagrees with about 20% of what is in idiomatic.js.

Anyways, I think your posts persuaded me to stick with JSLint and Crockford’s style as my main linter and style guide and to move on with life. :slight_smile: