Introduction

Lefthook is a Git hooks manager. Here is how to

  • Install lefthook to your project or globally.

  • Configure lefthook.yml with detailed options explanation.

See also: examples of lefthook common usage.

Example: Run your linters on pre-commit hook and forget about the routine.

# lefthook.yml

pre-commit:
  parallel: true
  jobs:
    - run: yarn run stylelint --fix {staged_files}
      glob: "*.css"
      stage_fixed: true

    - run: yarn run eslint --fix "{staged_files}"
      glob:
        - "*.ts"
        - "*.js"
        - "*.tsx"
        - "*.jsx"
      stage_fixed: true

Sponsored by Evil Martians

If you have a question or found a mistake in the documentation, please create a new discussion. Small contributions help maintaining the quality of the project.