10. Linters - Wiebsonice/GalleryMatch GitHub Wiki

A Linter is a tool which analyses your code to spot any programming errors, bugs, style errors and suspicious constructs. Linters are of good use to keep your code consistent, clean and error free. The very first linter was made around 1978, So they have been arount for a long time now. And since then have become way more complicated and more useful for the development world.

linters can be used for all kinds of types of code languages:

  • CSS
  • HTML
  • Javascript
  • and many more (C & C++)

JS linters

During the course it was recommended that we'd pid a JS linter to help us write consistent and error free code. During one of the coaching sessions we where asked to do some research over some linters we could find. I decided to research 3 different JS linters:

JSLint

JSLint is probably the oldest and one of the least configurable linters out there. This lint is also based on the book Douglas Crockford’s Javascript: The Good Parts. This is probably a good fit for starters. You can use the online linter but its more convenient to use it as a plugin for your code editor. The package is on the rime of writing running on version 0.12.1 with just over 16k weekly downloads.

One of the downsides of this the package isn't used a lot compared to the others, i found the documentation also a bit vague.

JSHint

JSHint is quite usable with its defaults, and one of the big plusses is the ability to configure this linter to your linking. It's usually seen as a good inbetweener between JSLint and ESLint. The package is way more used compared to JSlint. And the Package is running on version 2.10.2, and with just over 505k weekly downloads.

I think this would be a good fit for intermediate level developers, due to the blend of sensible defaults and good configuration options.

ESLint

ESLint is probably the most used Linter out there, It is extremely configurable and can even autoformat scripts to your preferred code formatting style. But It's also one of the down sides in my opinion. Due to it being so customisable it can feel like too much customisable, and it makes it harder to just pick up and start using it. But it is proven to be a well beloved linter, but i think mostly under developers who have been developing for over a few years now.

The package is running on version 5.16.0 and has around 6,820k weekly downloads. The documentation is super detailed and the linter is well maintained.

My verdict

Once again this is a personal preference thing. But for this project my choice goes to JSHint. I feel like it matches my code and development level at this stage. Its better maintained compared to JSLint and I found the documentation to be quite decent. And one of the plusses for me using it was that from default the JSHint is quite well setup from scratch. I've added the JSHint package in my code editor Atom, for next node project i might be looking at installing the NPM package.

But if I decide to continue in the development world and with the CMD course, I might be looking to ESLint in the far future. Who knows when that will be.


Information used from the following sites JSLint, JSHint, ESLint, gomakethings.com, JSLint NPM, JSHint NPM & ESLint NPM