Setup prettier pre-commit formatting with husky and lint-staged

- Install husky and lint-staged dev dependencies
- Configure pre-commit hook to run prettier on staged files
- Only format changed files to improve performance
- Prevents CI formatting failures by formatting locally
This commit is contained in:
olaservo 2025-08-18 08:43:09 -07:00
commit f7b1cd6f43

View file

@ -41,7 +41,7 @@
"prettier-fix": "prettier --write .",
"prettier-check": "prettier --check .",
"lint": "prettier --check . && cd client && npm run lint",
"prepare": "npm run build",
"prepare": "husky",
"publish-all": "npm publish --workspaces --access public && npm publish --access public",
"update-version": "node scripts/update-version.js",
"check-version": "node scripts/check-version-consistency.js"
@ -63,12 +63,19 @@
"@types/jest": "^29.5.14",
"@types/node": "^22.17.0",
"@types/shell-quote": "^1.7.5",
"husky": "^9.1.7",
"jest-fixed-jsdom": "^0.0.9",
"lint-staged": "^16.1.5",
"prettier": "^3.6.2",
"rimraf": "^6.0.1",
"typescript": "^5.4.2"
},
"engines": {
"node": ">=22.7.5"
},
"lint-staged": {
"**/*.{js,ts,jsx,tsx,json,md}": [
"prettier --write"
]
}
}