Skip to content

Commit ea0e33b

Browse files
committed
chore: add Husky pre-commit hook with lint-staged for ESLint/Prettier
1 parent a4a479a commit ea0e33b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
1818
"lint:fix": "eslint . --ext .ts,.tsx,.js,.jsx --fix",
1919
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css}\"",
20-
"format:check": "prettier --check ."
20+
"format:check": "prettier --check .",
21+
"prepare": "husky"
22+
},
23+
"lint-staged": {
24+
"*.{js,jsx,ts,tsx}": [
25+
"eslint --fix",
26+
"prettier --write"
27+
]
2128
},
2229
"dependencies": {
2330
"@docusaurus/core": "^3.9.1",
@@ -76,6 +83,8 @@
7683
"eslint-config-prettier": "^10.1.8",
7784
"eslint-plugin-prettier": "^5.5.4",
7885
"eslint-plugin-react": "^7.37.5",
86+
"husky": "^9.1.7",
87+
"lint-staged": "^16.2.3",
7988
"postcss": "^8.5.3",
8089
"prettier": "^3.6.2",
8190
"tailwindcss": "^4.1.4",

0 commit comments

Comments
 (0)