Skip to content

Commit 2972544

Browse files
authored
Create pre-commit hooks with husky to enforce linting and formating for all commits (RooCodeInc#1374)
* updated the hooks to ensure code cleanliness * updated package-lock for the CI/CD
1 parent a88d45d commit 2972544

File tree

5 files changed

+43
-6
lines changed

5 files changed

+43
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ node_modules
55
*.vsix
66

77
.DS_Store
8+
9+
pnpm-lock.yaml

.husky/pre-commit

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
echo "Running pre-commit checks..."
2+
3+
# Run ESLint
4+
echo "Running ESLint..."
5+
npm run lint || {
6+
echo "❌ ESLint check failed. Please fix the errors and try committing again."
7+
exit 1
8+
}
9+
10+
# Run Prettier
11+
echo "Running Prettier..."
12+
npm run format || {
13+
echo "❌ Prettier check failed. Run 'npm run format:fix' to automatically fix formatting issues."
14+
exit 1
15+
}
16+
17+
echo "✅ All checks passed!"

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dist/
22
node_modules
33
webview-ui/build/
4-
CHANGELOG.md
5-
package-lock.json
4+
*.md
5+
package-lock.json

package-lock.json

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@
164164
"start:webview": "cd webview-ui && npm run start",
165165
"build:webview": "cd webview-ui && npm run build",
166166
"test:webview": "cd webview-ui && npm run test",
167-
"publish:marketplace": "vsce publish && ovsx publish"
167+
"publish:marketplace": "vsce publish && ovsx publish",
168+
"prepare": "husky"
168169
},
169170
"devDependencies": {
170171
"@types/diff": "^5.2.1",
@@ -178,6 +179,7 @@
178179
"@vscode/test-electron": "^2.4.0",
179180
"esbuild": "^0.21.5",
180181
"eslint": "^8.57.0",
182+
"husky": "^9.1.7",
181183
"npm-run-all": "^4.1.5",
182184
"prettier": "^3.3.3",
183185
"should": "^13.2.3",

0 commit comments

Comments
 (0)