Skip to content

Latest commit

 

History

History
68 lines (44 loc) · 1.33 KB

husky.md

File metadata and controls

68 lines (44 loc) · 1.33 KB

Husky configuration

The purpose of the husky is running tasks on certain git actions.

Contents

Prerequisites

Setup

  • Add workspace reference to husky:

    pnpm add -w husky
  • Manually install husky hooks:

    pnpm husky install
  • Add husky's install hooks script:

    // package.json
    
    "scripts": {
      ...
      "prepare": "husky install"
      ...
    }
  • Add pre-commit hook for linting and formatting indexed files using lint-staged:

    pnpm husky add .husky/pre-commit 'pnpm lint-staged --quiet'
  • Add commit-msg hook for linting of commit message using commitlint:

    pnpm husky add .husky/commit-msg 'pnpm commitlint --edit $1'

Usage

  • Automatic execution lint-staged and commitlint on commit.
    In case of any failures, commit will be rejected.

License

MIT © Sergey Muravjev


⬅ Back