@droneey/devkit-ts-lefthook
v1.21.0
Published
Shared Lefthook configuration: the common git hooks for branch and commit validation, plus the Biome hook for TypeScript projects.
Maintainers
Readme
@droneey/devkit-ts-lefthook
Shared Lefthook configuration with composable git hooks.
Installation
bun add -d @droneey/devkit-ts-lefthook lefthookCreate lefthook.yml in your project root:
extends:
- node_modules/@droneey/devkit-ts-lefthook/configs/base.yml
- node_modules/@droneey/devkit-ts-lefthook/configs/biome.ymlbunx lefthook installConfiguration
Base
Language-agnostic hooks:
| Hook | Job | Description |
|---|---|---|
| pre-commit | validate-branch | Branch must match (feature\|fix\|hotfix)/{id}-{name} |
| commit-msg | commit-message | Conventional Commits with the types feat, fix, refactor, chore and ! for a breaking change; no scope, a sentence-case subject that is not a placeholder, no body or footer |
Betterleaks
Language-agnostic, like the base; it needs betterleaks on the path, pinned through mise (mise use betterleaks@<version>).
| Hook | Job | Description |
|---|---|---|
| pre-commit | secrets | Runs betterleaks git --pre-commit --staged --redact over the staged changes; the report never prints a secret |
Biome
| Hook | Job | Description |
|---|---|---|
| pre-commit | biome | Runs biome check --write on staged ts,tsx,js,jsx,json,md,yaml,yml files |
Overriding
Override any named job in your lefthook.yml:
extends:
- node_modules/@droneey/devkit-ts-lefthook/configs/base.yml
- node_modules/@droneey/devkit-ts-lefthook/configs/biome.yml
pre-commit:
jobs:
- name: biome
glob: "*.{ts,tsx,js,jsx,json}"Related Packages
| Package | Description | |---|---| | @droneey/devkit-ts-biome | Biome configuration (formatter + linter) | | @droneey/devkit-ts-tsconfig | TypeScript configuration |
License
MIT
Without npm
The base hooks are language-agnostic and live in packages/common/lefthook/base.yml of the devkit repository; this package ships a copy for TypeScript projects, which its build makes and git does not keep. A repository without npm pulls the same hooks through lefthook's remotes, pinned to a devkit release:
# lefthook.yml
remotes:
- git_url: https://github.com/droneey/devkit
ref: v1.10.0
configs:
- packages/common/lefthook/base.yml