Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pre-commit Hook for Linting and Formatting with Husky #117

Open
1 of 6 tasks
Naman-B-Parlecha opened this issue Jan 7, 2025 · 2 comments · May be fixed by #118
Open
1 of 6 tasks

Add Pre-commit Hook for Linting and Formatting with Husky #117

Naman-B-Parlecha opened this issue Jan 7, 2025 · 2 comments · May be fixed by #118

Comments

@Naman-B-Parlecha
Copy link
Contributor

Description:

Right now, there's nothing in place to catch linting or formatting issues before code gets committed. This means that sometimes broken or inconsistent code gets into the codebase, which leads to headaches in code reviews, CI failures, and slower development overall.

To solve this, I suggest adding a Husky pre-commit hook that runs ESLint for linting and Prettier for formatting checks before any code is committed. The hook will only run on staged files, so it will only check the changes that are actually about to be committed. This will help ensure that we don’t accidentally commit broken code or leave formatting issues behind, ultimately making the development process faster and smoother.

Issue Type:

  • Feature
  • Bug
  • Documentation
  • Improvement
  • Refactor
  • Task

Why This Is Needed:

  • Faster Development: Catching issues before they get committed means fewer problems later on, reducing delays during code review and CI.

  • Consistent Code: Ensures the codebase stays clean, properly formatted, and follows the same standards.

  • Avoiding Broken Code: By running these checks only on staged files before committing, we prevent broken code from slipping through and causing issues down the line.

@Naman-B-Parlecha Naman-B-Parlecha linked a pull request Jan 7, 2025 that will close this issue
2 tasks
@manthanabc
Copy link

Maybe adding github actions for this would be a better option.

@Naman-B-Parlecha
Copy link
Contributor Author

Naman-B-Parlecha commented Jan 8, 2025

@manthanabc Ya but pre commit hook will not allow any error code to be even committed

Which is better before even having a ci check

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 a pull request may close this issue.

2 participants