Why (and How) to Use eslint in Your Project

4

This story was written by Sam Roberts, a Senior Software Engineer at IBM Canada. It was first published in IBM developerWorks blog.

npmjs.org has 100s of thousands of packages, but that doesn’t mean they are of equal quality. Its important to check how well managed your direct dependencies are. …

Today’s topic is linting.

Well run projects have clear consistent coding conventions, with automated enforcement. When I review a project, and its code looks like a house built by a child using nothing but a hatchet and a picture of a house, it doesn’t inspire confidence that the code is functional.

Not having coding conventions is also a barrier to attracting contributions, and depending on a project that does not welcome (quality!) contributions is itself a risk.

Besides checking style, linters are also excellent tools for finding certain classes of bugs, such as those related to variable scope. Assignment to undeclared variables (these leak into the global scope, contaminating it and possibly causing very difficult to find bugs) and use of undefined variables are examples of errors that are detectable at lint time.

Read more at Medium