Skip to content

Commit 5beb4b1

Browse files
author
Erick Teowarang
committed
chore: add husky + lint-staged pre-commit hook for oxfmt
Run oxfmt on staged ts/tsx/js/jsx/mjs/cjs/json/jsonc/md/mdx/yaml/yml/css/html files before commit, preventing fmt:check failures in CI for cases that the local pnpm fmt invocation hasn't caught. - husky@9.1.7 + lint-staged@17.0.4 added as root devDependencies - prepare script wires husky on pnpm install so contributors get the hook - .husky/pre-commit runs `pnpm exec lint-staged`
1 parent 6763252 commit 5beb4b1

3 files changed

Lines changed: 137 additions & 646 deletions

File tree

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm exec lint-staged

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@
1010
"fmt": "oxfmt",
1111
"fmt:check": "oxfmt --check",
1212
"changeset:create": "changeset",
13-
"changeset:publish": "pnpm build && changeset publish"
13+
"changeset:publish": "pnpm build && changeset publish",
14+
"prepare": "husky"
1415
},
1516
"devDependencies": {
1617
"@changesets/cli": "^2.31.0",
18+
"husky": "9.1.7",
19+
"lint-staged": "17.0.4",
1720
"oxfmt": "catalog:",
1821
"oxlint": "catalog:",
1922
"turbo": "^2.9.14"
2023
},
24+
"lint-staged": {
25+
"*.{ts,tsx,js,jsx,mjs,cjs,json,jsonc,md,mdx,yaml,yml,css,html}": "oxfmt"
26+
},
2127
"engines": {
2228
"node": "24.x"
2329
},

0 commit comments

Comments
 (0)