feat: configure husky and lint-staged for pre-commit checks (#2558) - #3266
Open
aaniya22 wants to merge 2 commits into
Open
feat: configure husky and lint-staged for pre-commit checks (#2558)#3266aaniya22 wants to merge 2 commits into
aaniya22 wants to merge 2 commits into
Conversation
…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>
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
What Changed
husky,lint-staged, andprettieras dev dependenciesprepare: "husky"script andlint-stagedconfig topackage.json.husky/pre-commithook runningpnpm exec lint-stagedlint-stagedrunseslint --fix+prettier --writeon staged.js/.jsx/.ts/.tsxfiles, andprettier --writeon staged.json/.css/.mdfilesHow to Test
.ts/.tsxfile with a lint or formatting issue (e.g. inconsistent quotes, unused import)git commit -m "test"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
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
N/A — no UI/markup change.
Additional Context
Verified locally by committing a test file — hook triggered correctly,
eslint --fixandprettier --writeran on the staged file, and changes were re-staged automatically before the commit finished.