Skip to content

[Feature Request] Add Husky for Git Hook Automated Checks #146

@fishwww-ww

Description

@fishwww-ww

Background

The current project lacks automated validation before code commits, which may lead to the following issues:

  1. Committing non-compliant code (e.g., syntax errors, messy formatting);

  2. Inconsistent commit messages, which is not conducive to subsequent maintenance and version tracking;

  3. Inefficiency in team collaboration due to the need for manual reminders of specifications.

Solution

Introduce the husky library and configure core Git hooks:

  • pre-commit: Trigger ESLint/Prettier checks to ensure code format and syntax compliance;

  • commit-msg: Validate the format of commit messages (e.g., following Conventional Commits).

Advantages

  1. Lightweight: husky is small in size (core dependency is only a few KB) with no additional performance burden;

  2. Low intrusion: Only acts on Git hooks without modifying the core logic of the project;

  3. Easy to maintain: Configuration files can be committed to the repository, and team members can take effect automatically after pulling the code.

Additional Notes

  • I have confirmed that there are no conflicts with the project's existing dependencies (current project dependencies: XX/None);

  • I can submit a PR to complete the configuration, ensuring the code complies with the project's existing specifications;

  • Please let me know if there are any other requirements (e.g., adding/removing hooks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions