Skip to content

chore: setup husky and lint-staged pre-commit hook#206

Open
mayannkkk19 wants to merge 3 commits into
geturbackend:mainfrom
mayannkkk19:chore/setup-husky-lintstaged
Open

chore: setup husky and lint-staged pre-commit hook#206
mayannkkk19 wants to merge 3 commits into
geturbackend:mainfrom
mayannkkk19:chore/setup-husky-lintstaged

Conversation

@mayannkkk19
Copy link
Copy Markdown

@mayannkkk19 mayannkkk19 commented May 25, 2026

🚀 Pull Request Description

Fixes #202
Set up Husky and lint-staged to run ESLint on staged JavaScript/React files before commits.

Changes Made:

  • added Husky pre-commit hook
  • configured lint-staged for staged JS/JSX files
  • added prepare script for automatic hook setup
  • configured workspace lint command for web-dashboard

🛠️ Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 UI/UX improvement (Frontend only)
  • ⚙️ Refactor / Chore

🧪 Testing & Validation

Backend Verification:

  • I have run npm test in the backend/ directory and all tests passed.
  • I have verified the API endpoints using Postman/Thunder Client.
  • New unit tests have been added (if applicable).

Frontend Verification:

  • I have run npm run lint in the frontend/ directory.
  • Verified the UI changes on different screen sizes (Responsive).
  • Checked for any console errors in the browser dev tools.

📸 Screenshots / Recordings (Optional)

✅ Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings or errors.
  • I have updated the documentation (README/Docs) accordingly.

Built with ❤️ for urBackend.

Summary by CodeRabbit

  • Chores
    • Added a pre-commit hook to run automated quality checks on staged changes, enforcing code standards before commits.
    • Configured lint-staged to run ESLint on staged files to catch issues early.
    • Wired project scripts to support the new commit hook tooling and added related dev dependencies to the development setup.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@mayannkkk19, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 3 minutes and 10 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c017835e-b32c-414a-872f-114f6539d5a4

📥 Commits

Reviewing files that changed from the base of the PR and between 2544514 and 770e328.

📒 Files selected for processing (1)
  • package.json
📝 Walkthrough

Walkthrough

Adds Husky and lint-staged, configures a prepare script in package.json, adds a lint-staged rule for apps/web-dashboard/**/*.{js,jsx}, and creates a .husky/pre-commit hook that runs npx lint-staged before commits.

Changes

Pre-commit Linting Infrastructure

Layer / File(s) Summary
Package configuration for pre-commit linting
package.json
scripts gains prepare to install Husky; lint-staged config added to run ESLint on staged apps/web-dashboard/**/*.{js,jsx}; devDependencies add husky and lint-staged.
Pre-commit hook script
.husky/pre-commit
POSIX shell script with sh shebang that invokes npx lint-staged when the pre-commit hook runs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit taps keys in moonlit code,
Hooks set to guard the commit road.
Lint-staged checks each staged file’s art,
Husky ensures we don’t depart.
Clean commits hop home with a happy heart. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: setup husky and lint-staged pre-commit hook' clearly and concisely describes the main changes in the PR, which adds Husky and lint-staged configuration for automated pre-commit linting.
Linked Issues check ✅ Passed The PR successfully implements all key requirements from issue #202: installs husky and lint-staged as devDependencies, creates .husky/pre-commit hook, adds lint-staged configuration to run eslint on staged JS/JSX files, and includes the prepare script.
Out of Scope Changes check ✅ Passed All changes are directly related to setting up Husky and lint-staged as specified in issue #202; no out-of-scope modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 17-21: The lint-staged config in package.json incorrectly matches
monorepo files and ignores staged filenames because it uses "*.{js,jsx}" with
the web-dashboard npm run lint that executes "eslint ."; update lint-staged to
scope patterns to the web-dashboard directory (e.g.,
"apps/web-dashboard/**/*.{js,jsx}") and invoke eslint directly so lint-staged
will pass filenames (replace the current "npm run lint --workspace=web-dashboard
--" entry with a direct "eslint" command), and if other workspaces need linting
add workspace-specific patterns referencing their eslint configs (e.g.,
apps/dashboard-api/**/* .js -> "eslint --config
apps/dashboard-api/eslint.config.js") so each workspace is linted with the
correct config and only staged files are checked.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4107ab00-3b39-4d4f-b2ef-aceb1c4cda9a

📥 Commits

Reviewing files that changed from the base of the PR and between 3d9cbee and de3b9c3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • .husky/pre-commit
  • package.json

Comment thread package.json
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.

[DevOps/DX] Setup Pre-commit hooks using Husky & Lint-staged

1 participant