How to config Git Hooks + ESLint

$ mkdir eslint_git_hooks # Creates a new folder with name “eslint_git_hooks”$ cd eslint_git_hooks # Enters the folder eslint_git_hooks$ npm init –y # Creates a new npm project$ git init # Initiate git in your eslint_git_hooks folder$ npm i –g eslint babel-eslint # Installs ESlint and Babel ESLint globally in your system
eslit_git_hooks folder structure
$ cd .git/hooks
$ cp pre-commit.sample pre-commit
# exec git diff-index — check — cached $against — 
eslint .
$ exec bash



Senior Backend Software Engineer (Node.js)

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store