A fork of pre-commit with experimental workdir setting support.
Using this fork, you can configure some hooks to run "as-if" the selected subfolders were in repository root.
E.g., with the following directory structure:
.
โโโ .git
โโโ backend
โ โโโ pyproject.toml
โ โโโ uv.lock
โโโ frontend
โ โโโ package.json
โ โโโ pnpm-lock.yaml
โ โโโ biome.jsonc
โ โโโ src
โ โโโ tsconfig.json
โ โโโ vite.config.js
โโโ .pre-commig-config.yaml
the following file will find backend-related and frontend-related files correctly:
repos:
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.24
hooks:
- id: uv-lock
workdir: backend
- repo: https://github.com/biomejs/pre-commit
rev: "v0.5.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome"]
language_version: "20.18.0"
workdir: frontend