Skip to content

[FEATURE] Add pre-commit hooks with Husky and lint-staged #5007

@sammy200-ui

Description

@sammy200-ui

Currently, the project relies solely on CI if-nodejs-pr-testing.yml workflow to catch lint errors.
This creates a slow feedback loop in which a contributor pushes code -> waits for the CI to run -> sees a failure -> fixes a small styling issue -> and has to push again.
I experienced this from my recent pr #4997

Solution - Add pre-commit hooks using Husky and lint-staged to automatically run ESLint and Prettier on staged files before each commit. This will catch linting issues early in the development cycle, reducing CI failures and review round-trips.

How this Setup will work -
1- when a developer runs git commit - Husky triggers
2- lint-staged scans only the files that are currently staged
3- It runs Prettier and ESLint on those files.
4- If it can fix the errors automatically, it does so and adds them to the commit. If not, it warns the user.

Yes, I am interested in making a pr!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To Be Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions