Skip to content

feat: configure husky and lint-staged for pre-commit checks (#2558) - #3266

Open
aaniya22 wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
aaniya22:feature/2558-husky-lint-staged
Open

feat: configure husky and lint-staged for pre-commit checks (#2558)#3266
aaniya22 wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
aaniya22:feature/2558-husky-lint-staged

Conversation

@aaniya22

Copy link
Copy Markdown
Contributor

Summary

Configured Husky and lint-staged to automatically run ESLint and Prettier on staged files before each commit, catching lint/format issues before they land in the repo.

Closes #2558


Type of Change

  • ✨ New feature (non-breaking change that adds functionality)

What Changed

  • Installed husky, lint-staged, and prettier as dev dependencies
  • Added prepare: "husky" script and lint-staged config to package.json
  • Added .husky/pre-commit hook running pnpm exec lint-staged
  • lint-staged runs eslint --fix + prettier --write on staged .js/.jsx/.ts/.tsx files, and prettier --write on staged .json/.css/.md files

How to Test

  1. Stage a .ts/.tsx file with a lint or formatting issue (e.g. inconsistent quotes, unused import)
  2. Run git commit -m "test"
  3. Confirm the pre-commit hook runs and auto-fixes the issue before the commit completes

Expected result: ESLint and Prettier run automatically on staged files, fixes are applied and re-staged, and the commit succeeds with clean code.


Screenshots / Recordings

N/A — tooling change, no UI impact.


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Accessibility (UI changes only)

N/A — no UI/markup change.


Additional Context

Verified locally by committing a test file — hook triggered correctly, eslint --fix and prettier --write ran on the staged file, and changes were re-staged automatically before the commit finished.

…u-byte-coder#2558)

Runs eslint --fix and prettier --write on staged js/jsx/ts/tsx files,
and prettier --write on staged json/css/md files, before each commit.

Signed-off-by: aaniya22 <aaniyaatomar@gmail.com>
@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure Husky & Lint-Staged for pre-commit checks

1 participant