1.) Install dev dependencies:

npm install husky lint-staged eslint --save-dev

Note: if you get an error like

ENOENT: no such file or directory, mkdir 'node_modules/husky/.git/hooks'
husky > Failed to install

just update your git to latest version and it should install fine.

2.) Update package.json with husky and lint-staged definitions by adding:

 ...
 "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,jsx}": [
      "eslint --fix",
      "git add"
    ]
  }
  ...

Note: you may want to also add ts besides {js,jsx} if you use typescript.

3.) Test:

edit a file, add in a debugger or console.log, stage the file and try to commit. Husky should run and report you and error.

This is the very basic setup – for all extra consult the docs: https://github.com/okonet/lint-staged

oneplus one OS upgrade rendering 10.000 svg icons