Create pre-commit hooks with husky to enforce linting and formating for all commits (#1374)

* updated the hooks to ensure code cleanliness

* updated package-lock for the CI/CD
This commit is contained in:
Daniel Steigman 2025-01-21 21:48:43 -08:00 committed by GitHub
parent a88d45d8b4
commit 29725445cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 43 additions and 6 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ node_modules
*.vsix *.vsix
.DS_Store .DS_Store
pnpm-lock.yaml

17
.husky/pre-commit Executable file
View File

@ -0,0 +1,17 @@
echo "Running pre-commit checks..."
# Run ESLint
echo "Running ESLint..."
npm run lint || {
echo "❌ ESLint check failed. Please fix the errors and try committing again."
exit 1
}
# Run Prettier
echo "Running Prettier..."
npm run format || {
echo "❌ Prettier check failed. Run 'npm run format:fix' to automatically fix formatting issues."
exit 1
}
echo "✅ All checks passed!"

View File

@ -1,5 +1,5 @@
dist/ dist/
node_modules node_modules
webview-ui/build/ webview-ui/build/
CHANGELOG.md *.md
package-lock.json package-lock.json

22
package-lock.json generated
View File

@ -1,13 +1,12 @@
{ {
"name": "claude-dev", "name": "claude-dev",
"version": "3.2.0", "version": "3.2.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "claude-dev", "name": "claude-dev",
"version": "3.1.11", "version": "3.2.4",
"version": "3.2.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@anthropic-ai/bedrock-sdk": "^0.10.2", "@anthropic-ai/bedrock-sdk": "^0.10.2",
@ -61,6 +60,7 @@
"@vscode/test-electron": "^2.4.0", "@vscode/test-electron": "^2.4.0",
"esbuild": "^0.21.5", "esbuild": "^0.21.5",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"husky": "^9.1.7",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"should": "^13.2.3", "should": "^13.2.3",
@ -7694,6 +7694,22 @@
"ms": "^2.0.0" "ms": "^2.0.0"
} }
}, },
"node_modules/husky": {
"version": "9.1.7",
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
"dev": true,
"license": "MIT",
"bin": {
"husky": "bin.js"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/typicode"
}
},
"node_modules/iconv-lite": { "node_modules/iconv-lite": {
"version": "0.6.3", "version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",

View File

@ -164,7 +164,8 @@
"start:webview": "cd webview-ui && npm run start", "start:webview": "cd webview-ui && npm run start",
"build:webview": "cd webview-ui && npm run build", "build:webview": "cd webview-ui && npm run build",
"test:webview": "cd webview-ui && npm run test", "test:webview": "cd webview-ui && npm run test",
"publish:marketplace": "vsce publish && ovsx publish" "publish:marketplace": "vsce publish && ovsx publish",
"prepare": "husky"
}, },
"devDependencies": { "devDependencies": {
"@types/diff": "^5.2.1", "@types/diff": "^5.2.1",
@ -178,6 +179,7 @@
"@vscode/test-electron": "^2.4.0", "@vscode/test-electron": "^2.4.0",
"esbuild": "^0.21.5", "esbuild": "^0.21.5",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"husky": "^9.1.7",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"should": "^13.2.3", "should": "^13.2.3",