Standard.js

I know how linting makes your code so much nicer, but I'm not sure how many hours of my life have been wasted in the past through discussions about semi-colons, how many spaces ad nauseum. Step in Standard.js.

First I removed all my existing eslint and dependency modules (including Airbnb, about 4 of them).

Then I installed locally for dev, updated my npm scripts.

npm i standard --save-dev

Then installed globally so I have access to the command standard on any directory and lint:

standard --fix

I didn't have to make many fixes to my code, although standard did find that I was using 'await' unneccessarily on a couple of functions, which was an immediate improvement to the code.

I use Jest and a couple of issues flagged up. I updated my package.json file to include the jest environment:

  "standard": {
    "env": [
      "jest"
    ]
  },

When in development mode you may need to add this at the top of the file:

/* eslint-env jest */

Which leads to the VSCode plugin. You can set this up to automatically fix any linting issues when you save. So good!

Alternative - Prettier.js

Install:

npm install --save-dev --save-exact prettier
prettier  --write src/js/**/*

To be honest, Standard is easier to integrate. I'm not totally convinced on Prettier.

References

-How to setup standard.js for VSCode and Typescript