Repository navigation
|
In one of the projects I've worked on, I used Husky alongside lint-staged to format code with Bun, Biome, and Prettier using the following setup:
bunx lint-staged
"lint-staged": {
"**/*.{md,mdx}": "prettier --write",
"**/*.{css,js,jsx,ts,tsx,cjs,mjs,json}": "biome check --write --unsafe"
}I am planning to switch to |
Replies: 1 comment
|
You do not strictly need all three, but they have separate jobs:
For a Bun project, I would keep Husky + lint-staged and replace the formatter configuration with Oxfmt: bun add -d husky lint-staged oxfmt
bunx husky init# .husky/pre-commit
bunx lint-staged{
"scripts": {
"prepare": "husky",
"fmt": "oxfmt",
"fmt:check": "oxfmt --check"
},
"lint-staged": {
"*": "oxfmt --no-error-on-unmatched-pattern"
}
}The You can remove lint-staged and build the staged-file list directly in the shell hook, as Husky documents, but then you own filename quoting, filtering, re-staging, and partially staged-file behavior. Keeping lint-staged is usually worth that small dependency unless your hook is deliberately minimal. One migration caveat: Oxfmt replaces Prettier/formatting, not Biome lint rules. If References:
|
You do not strictly need all three, but they have separate jobs:
pre-commithook.For a Bun project, I would keep Husky + lint-staged and replace the formatter configuration with Oxfmt:
# .husky/pre-commit bunx lint-staged{ "scripts": { "prepare": "husky", "fmt": "oxfmt", "fmt:check": "oxfmt --check" }, "lint-staged": { "*": "oxfmt --no-error-on-unmatched-pattern" } }The
*matcher is intentional: lint-staged passes staged paths, Oxfmt formats the languages it supports, and--no-error-on-…