-
-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Feature Request 🛍️
Add Husky for Pre-Commit Hooks
Use Case
Currently, the project uses ESLint, but there are no Git hooks to enforce linting before commits. Additionally, Prettier is proposed in an open PR (#301) but has not yet been merged. Without Git hooks, contributors might commit unformatted or non-linted code, leading to inconsistencies in the codebase.
Adding Husky will ensure that:
- ESLint runs before every commit.
- Once Prettier is merged, it can be included in the hook to enforce consistent formatting.
- Contributors follow coding standards automatically.
Possible Solution
To address this, Husky can be integrated into the project to manage Git hooks, ensuring automated checks before commits. By configuring Husky alongside lint-staged, we can enforce ESLint rules on staged files, maintaining code consistency and quality. Additionally, a pre-commit hook will be added to run TypeScript type checks and unit tests, preventing broken code from entering the repository. Once Prettier is merged, we can extend the hook to include formatting checks. This approach streamlines the development workflow while reducing the likelihood of linting or formatting issues in committed code.
Context
- This change will prevent contributors from committing incorrectly linted code.
- It will help maintain consistent code quality across the project.
- The use of lint-staged ensures that only staged files are checked, keeping the process fast and efficient.
Detailed Description
- Add Husky for managing Git hooks.
- Configure ESLint to run via lint-staged on pre-commit.
- Add a pre-commit hook to check TypeScript and run tests.
- Once Prettier is merged (PR feat(workflow): Add ESLint + Prettier Workflow for Automated Code Quality Checks #301), update the hook to include formatting enforcement.
- Ensure that all changes follow the project's coding standards before being committed.