Skip to content

Add Pre-commit Hooks for Code Quality Enforcement #144

@shashi-sah2003

Description

@shashi-sah2003

Is your feature request related to a problem? Please describe.

Currently, the project doesn't have pre-commit hooks configured, which means linting and formatting checks aren't automatically run before commits. This allows inconsistent code style and potential issues to be committed to the repository. Developers might forget to run linting or formatting scripts manually before committing, which can lead to:

  • Inconsistent code formatting across the codebase
  • Linting errors making it into the codebase
  • Extra review cycles needed to fix styling issues

Describe the solution you'd like
I propose adding pre-commit hooks using Husky and lint-staged to automatically run the existing linting and formatting tools before each commit.

Specifically:

  1. Install Husky and lint-staged as dev dependencies
  2. Configure Husky to run lint-staged on pre-commit
  3. Configure lint-staged to run:
    • ESLint on JavaScript/TypeScript files (using the existing lint:ts script)
    • Prettier on all supported files (using the existing format script)
    • markdownlint on Markdown files (using the existing lint:md script)

Describe alternatives you've considered

  1. CI-only checks: We could rely solely on CI checks to catch these issues, but this increases the feedback loop time and can lead to more back-and-forth during PR reviews.
  2. Documentation only: We could simply document that developers should run linting/formatting manually, but this relies on developers remembering to do so and is error-prone.

Hey @pikurasa if you are okay with above feature request then I would like to work on it?
thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions