feat: Implement Advanced Husky Git Hooks with Secret Scanning, Changelog Enforcement
Summary
This MR introduces advanced Git hooks using Husky and establishes automated quality gates for security and test coverage.
Key Changes
1. Git Hooks Infrastructure (.husky/)
Pre-commit:
- Added logic to scan for and block unresolved merge conflict markers (
<<<<<<<,=======). - Integrated
secretlintto detect and block committed credentials. - Retained automated formatting and project build checks.
Pre-push:
-
Changelog Enforcement: Pushes fail if source code changes are detected without a corresponding update to
CHANGELOG.md.
2. Test Coverage (53% Threshold)
Added or significantly improved coverage for the following modules:
| Category | Modules |
|---|---|
| Hooks |
useGeolocation, useNetworkStrength, use-mobile
|
| Schemas | OTP, Password Login, and Signup validation |
| API | Interceptor and auth-header logic in axiosInstance
|
| Utils |
geoUtils (formatting), profileUtils (completion logic) |
| UI Components |
Button and Card base components |
| Pages | Redirect and login logic in LoginPage
|
3. Tooling & Configuration
- Added
secretlintand@secretlint/secretlint-rule-preset-recommend. - Configured
.secretlintrc.jsonand initialized a baseCHANGELOG.md.
How to Test
- Verify Secrets: Attempt to commit a file with a dummy API key — the commit should be blocked.
-
Verify Changelog: Modify any file in
src/and attempt to push without stagingCHANGELOG.md— the push should fail. -
Verify Coverage: Run
npm run test:coverageto confirm the threshold is being respected.
Checklist
-
Code follows the style guidelines of this project. -
Self-review of code completed. -
Code commented in hard-to-understand areas. -
Tests added to prove fix or feature works. -
New and existing unit tests pass locally. -
Dependent changes merged and published in downstream modules.