Skip to content

build: Add husky pre-commit hook #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Format code
npm run format
# Lint code
npm run lint
# Run build
npm run build
# Run tests
npm test
29 changes: 23 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"build": "tsc",
"test": "jest",
"lint": "eslint src/**/*.ts",
"prepare": "npm run build"
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
"prepare": "husky"
},
"devDependencies": {
"@eslint/js": "^9.18.0",
Expand All @@ -59,7 +60,9 @@
"@typescript-eslint/parser": "^8.21.0",
"eslint": "^9.18.0",
"eslint-plugin-prettier": "^5.2.3",
"husky": "^9.1.7",
"jest": "^29.7.0",
"prettier": "^3.5.3",
"ts-jest": "^29.2.5",
"typescript": "^5.7.3"
},
Expand Down
6 changes: 3 additions & 3 deletions tests/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ describe('InferenceGatewayClient', () => {
id: 'call_123',
type: 'function',
function: {
name: 'get_weather',
arguments: '{"location":"San Francisco, CA"}'
}
name: 'get_weather',
arguments: '{"location":"San Francisco, CA"}',
},
});
expect(callbacks.onFinish).toHaveBeenCalledTimes(1);
});
Expand Down