Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (28 sloc) 820 Bytes

Lefthook in Node.js

This is guide of using Lefthook git hook manager in Node.js projects. You can find guides for other environments in README.md.

Install

Lefthook is available on npm and can be installed with:

npm install @arkweid/lefthook --save-dev

Edit

Edit lefthook.yml:

pre-commit:
  parallel: true
  commands:
    linter:
      files: git diff --name-only @{push}
      glob: "*.{js,ts}"
      run: npx eslint {files}
    tests:
      files: git diff --name-only @{push}
      glob: "*.{js,ts}"
      run: jest --findRelatedTests {files}

Test it

npx lefthook install && npx lefthook run pre-commit

More info

Have a question? Check the wiki.

You can’t perform that action at this time.