Skip to content

Commit 4f54462

Browse files
feat: add pre-commit hook with Prettier formatting (#1576)
This commit adds automatic code formatting on pre-commit using Husky and lint-staged. The hook will: - Run Prettier on all staged files - Automatically fix formatting issues when possible - Ensure consistent code style across the codebase Changes: - Added lint-staged as a dev dependency - Configured lint-staged to run Prettier with --write --ignore-unknown - Created .husky/pre-commit hook to execute lint-staged All files will be formatted according to the existing .prettierrc configuration before each commit.
1 parent 6bda424 commit 4f54462

3 files changed

Lines changed: 233 additions & 110 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 lint-staged

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@types/babel__traverse": "^7.20.7",
2222
"commitlint": "^19.7.1",
2323
"husky": "^9.1.7",
24+
"lint-staged": "^16.2.6",
2425
"prettier": "^3.4.2",
2526
"turbo": "^2.5.0"
2627
},
@@ -30,5 +31,8 @@
3031
"minimatch": "^10.0.3",
3132
"node-machine-id": "^1.1.12"
3233
},
33-
"packageManager": "pnpm@9.12.3"
34+
"packageManager": "pnpm@9.12.3",
35+
"lint-staged": {
36+
"*": "prettier --write --ignore-unknown"
37+
}
3438
}

0 commit comments

Comments
 (0)