Skip to content

feat: configure Husky and lint-staged for automated pre-commit checks (#111)#142

Merged
ayomideadeniran merged 1 commit intoSoroLabs:mainfrom
JosephOnuh:feat/husky-lint-staged
Mar 29, 2026
Merged

feat: configure Husky and lint-staged for automated pre-commit checks (#111)#142
ayomideadeniran merged 1 commit intoSoroLabs:mainfrom
JosephOnuh:feat/husky-lint-staged

Conversation

@JosephOnuh
Copy link
Copy Markdown
Contributor

Summary

Closes #111

Introduces automated pre-commit hooks to the SoroTask monorepo using Husky and lint-staged. Ensures all staged code adheres to ESLint and Prettier configurations before reaching the repository, reducing CI noise and preventing poorly formatted code from entering the main branch.

Key Changes

  • Husky Setup: Added root package.json with "prepare": "husky" script. Git hooks trigger automatically on every local commit after npm install.
  • Lint-Staged Integration: .lintstagedrc.json configured to only process staged files — keeps commits fast as the monorepo grows.
  • Automated Fixes: Hooks auto-fix linting issues and formatting discrepancies where possible.
  • Developer Docs: README updated with a "Git Hooks" section covering how hooks work and how to bypass them when strictly necessary.

Files Changed

  • package.json — root devDependencies (husky, lint-staged) + prepare script
  • package-lock.json — lockfile for root dependencies
  • .lintstagedrc.json — lint-staged rules for JS/TS and config/doc files
  • .husky/pre-commit — hook script running npx lint-staged
  • README.md — added "Git Hooks" section

How to Verify

  1. Run npm install from the repo root to trigger the prepare script and install hooks.
  2. Introduce a formatting error in any .ts file (e.g., inconsistent indentation).
  3. Run git add . && git commit -m "test" — hooks should run, auto-fix the file, and complete the commit.
  4. Run git commit -m "test" --no-verify — verify hooks are skipped entirely.

Checklist

  • Husky prepare script added to root package.json
  • .lintstagedrc.json covers all relevant file extensions
  • Pre-commit hook script is executable (chmod +x)
  • Documentation added to README

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@JosephOnuh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ayomideadeniran
Copy link
Copy Markdown
Contributor

Pr under review.

@ayomideadeniran ayomideadeniran merged commit a421d3a into SoroLabs:main Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevExp] Configure Husky and Lint-Staged for Pre-commit Checks

2 participants