Skip to content

Conversation

@revaarathore11
Copy link

@revaarathore11 revaarathore11 commented Jan 28, 2026

Summary

This PR modernizes the Git hooks setup by upgrading Husky from v8 to v9 and introducing lint-staged to optimize pre-commit checks. The updated configuration improves performance, simplifies maintenance, and enhances the local developer experience.

Changes
• Upgrade Husky to v9
• Migrated from Husky v8 to v9 for a cleaner and more streamlined hooks setup.
• Add lint-staged
• Runs checks only on staged files, significantly reducing pre-commit execution time.
• ESLint auto-fix
• Automatically runs eslint --fix on staged .ts files.
• Prettier formatting
• Formats staged source files, JSON, Markdown, and YAML files.
• Remove legacy Husky internals
• Deleted the deprecated .husky/_ directory, which is no longer required in Husky v9.

Checklist
• My code follows the contributing guidelines of this project
• I am aware that all my commits will be squashed into a single commit using the PR title
• I have performed a self-review of my own code
• I have commented my code in hard-to-understand areas
• I have updated user-facing documentation where applicable
• My changes generate no new warnings
• I have added tests where applicable
• I have not reduced existing code coverage

Notes

This is a developer tooling–only change aimed at improving the local development workflow.
No tests were added, as the changes are configuration-based and can be verified manually by creating a commit and observing the pre-commit behavior.

Summary by Sourcery

Update Git hooks configuration to use Husky v9 with lint-staged for staged-file linting and formatting.

New Features:

  • Introduce lint-staged configuration to run ESLint fixes and Prettier formatting on staged files before commit.

Build:

  • Upgrade Husky to v9 and adjust the npm prepare script accordingly.

Chores:

  • Add tooling configuration to automatically format and lint staged files via pre-commit hooks.

screenshot:

image

- Upgrade Husky from v8 to v9
- Add lint-staged for running checks only on staged files
- Configure ESLint with auto-fix for .ts files
- Configure Prettier for source files, JSON, Markdown, and YAML
- Remove deprecated .husky/_ directory
@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2026

⚠️ No Changeset found

Latest commit: 2782f95

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Jan 28, 2026

@revaarathore11 is attempting to deploy a commit to the elixir-cloud-aai Team on Vercel.

A member of the Team first needs to authorize it.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 28, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Modernizes the Git hooks setup by upgrading Husky to v9, wiring it into npm scripts, and introducing lint-staged configuration to run ESLint --fix and Prettier only on staged files during pre-commit, while removing legacy Husky internals and updating lockfile metadata.

Sequence diagram for updated Husky v9 pre-commit with lint-staged

sequenceDiagram
  actor Developer
  participant Git
  participant Husky_v9 as Husky v9
  participant lint_staged as lint-staged
  participant ESLint
  participant Prettier

  Developer->>Git: git commit
  Git->>Husky_v9: Trigger pre-commit hook
  Husky_v9->>lint_staged: Run lint-staged on staged files
  lint_staged->>ESLint: eslint --fix on staged *.ts
  lint_staged->>Prettier: prettier --write on staged *.{ts,js,mjs,json,md,yaml,yml}
  ESLint-->>lint_staged: Lint and auto-fix complete
  Prettier-->>lint_staged: Formatting complete
  lint_staged-->>Husky_v9: Exit code (success or failure)
  Husky_v9-->>Git: Pre-commit result
  Git-->>Developer: Commit succeeds or is rejected
Loading

Flow diagram for Husky v9 and lint-staged pre-commit pipeline

flowchart LR
  Dev["Developer runs git commit"] --> GitHook["Git pre-commit hook"]
  GitHook --> Husky["Husky v9 pre-commit script"]
  Husky --> LintStaged["lint-staged"]

  subgraph Lint_Configs["lint-staged configuration in package.json"]
    TSFiles["Pattern: *.ts"] --> ESLintFix["Command: eslint --fix"]
    MultiFiles["Pattern: *.{ts,js,mjs,json,md,yaml,yml}"] --> PrettierWrite["Command: prettier --write"]
  end

  LintStaged --> TSFiles
  LintStaged --> MultiFiles

  ESLintFix --> LintStaged
  PrettierWrite --> LintStaged

  LintStaged -->|All checks pass| CommitOK["Commit proceeds"]
  LintStaged -->|Any check fails| CommitBlocked["Commit is blocked"]
Loading

File-Level Changes

Change Details Files
Upgrade Husky to v9 and adjust npm hook wiring to match the new version’s usage.
  • Update husky dependency version to ^9.1.7 in devDependencies.
  • Change the prepare script to invoke the Husky v9 binary directly instead of husky install.
  • Update lockfile entries to reflect the Husky upgrade.
package.json
package-lock.json
Introduce lint-staged to run targeted ESLint and Prettier actions on staged files in pre-commit.
  • Add lint-staged as a dev dependency.
  • Define a lint-staged config block to run eslint --fix on staged TypeScript files.
  • Configure lint-staged to run Prettier on staged TypeScript, JavaScript, JSON, Markdown, and YAML files.
  • Update pre-commit hook to invoke lint-staged as part of the commit workflow.
  • Update lockfile entries to include lint-staged and its dependency tree.
package.json
.husky/pre-commit
package-lock.json
Remove legacy Husky v8 internals that are no longer needed in v9.
  • Delete the deprecated Husky internal directory previously used by v8 hooks implementation.
  • Rely on the new Husky v9 hook layout without the internal scripts directory.
.husky/_ (removed from repo)

Possibly linked issues

  • #(not specified): They match exactly: Husky v9 + lint-staged pre-commit running ESLint --fix and Prettier on staged files.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The diff doesn’t show any change to .husky/pre-commit; make sure the hook actually runs lint-staged (e.g., npx lint-staged) so the new configuration is exercised on commit.
  • Your lint-staged config runs on *.ts and then again on *.{ts,js,...}, so TypeScript files will be processed twice; consider consolidating to a single entry per extension (e.g., "*.ts": ["eslint --fix", "prettier --write"]) to avoid redundant work.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The diff doesn’t show any change to `.husky/pre-commit`; make sure the hook actually runs `lint-staged` (e.g., `npx lint-staged`) so the new configuration is exercised on commit.
- Your `lint-staged` config runs on `*.ts` and then again on `*.{ts,js,...}`, so TypeScript files will be processed twice; consider consolidating to a single entry per extension (e.g., `"*.ts": ["eslint --fix", "prettier --write"]`) to avoid redundant work.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@revaarathore11
Copy link
Author

@uniqueg please review

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 this pull request may close these issues.

1 participant