Skip to content

chore(deps): update dependency husky to v9 - #321

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/husky-9.x
Open

chore(deps): update dependency husky to v9#321
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/husky-9.x

Conversation

@renovate

@renovate renovate Bot commented Jan 25, 2024

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
husky ^8.0.1^9.0.0 age confidence

Release Notes

typicode/husky (husky)

v9.1.7

Compare Source

What's Changed

New Contributors

Full Changelog: typicode/husky@v9.1.6...v9.1.7

v9.1.6

Compare Source

What's Changed

New Contributors

Full Changelog: typicode/husky@v9.1.5...v9.1.6

v9.1.5

Compare Source

What's Changed

New Contributors

Full Changelog: typicode/husky@v9.1.4...v9.1.5

v9.1.4

Compare Source

  • Improve deprecation notice

v9.1.3

Compare Source

  • fix: better handle space in PATH

v9.1.2

Compare Source

Show a message instead of automatically removing deprecated code.

This only concerns projects that still have the following code in their hooks:

- #!/usr/bin/env sh # <- This is deprecated, remove it
- . "$(dirname -- "$0")/_/husky.sh"  # <- This is deprecated, remove it

# Rest of your hook code

Hooks with these lines will fail in v10.0.0

v9.1.1

Compare Source

Super saiyan god dog! It's over 9.0.0!

What's new

You can now run package commands directly, no need for npx or equivalents.
It makes writing hooks more intuitive and is also slightly faster 🐺⚡️

# .husky/pre-commit
- npx jest
+ jest # ~0.2s faster

A new recipe has been added to the docs. Lint staged files without external dependencies (inspired by Prettier docs). Feel free to modify it.

# .husky/pre-commit
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
git update-index --again

For more advanced use cases, see lint-staged.

Fixes

  • bunx husky init command
  • Workaround for some hooks implementation on Windows

Deprecations

  • #!/usr/bin/env sh and . "$(dirname -- "$0")/_/husky.sh" are deprecated. husky command will automatically remove them, no action required.
  • If you're having code in ~/.huskyrc please move it to .config/husky/init.sh

Support for these will be removed in v10.

Friendly reminder

If Git hooks don't fit your workflow, you can disable Husky globally. Just add export HUSKY=0 to .config/husky/init.sh.

I've seen some confusion about this on X, so just a heads-up!

Sponsoring

Husky is downloaded over 45M times per month and used by ~1.5M projects. If your company wants to sponsor, you can do so here: GitHub Sponsors.

Have a nice summer ☀️ I'm open to new opportunities/consulting so feel free to drop me a message 😉

v9.1.0

Compare Source

v9.0.11

Compare Source

v9.0.10

Compare Source

v9.0.9

Compare Source

v9.0.8

Compare Source

v9.0.7

Compare Source

  • fix: typo and source ~/.huskyrc correctly (compatibility with v8)
  • docs: fix example by @​typicode in #​1363

v9.0.6

Compare Source

v9.0.5

Compare Source

v9.0.4

Compare Source

v9.0.3

Compare Source

v9.0.2

Compare Source

v9.0.1

Compare Source

Kicking off the year with an exciting update!

Note: install using husky@latest to get the bug fixes that were released after.

Introducing husky init

v8
npm pkg set scripts.prepare="husky install"
npm run prepare
npx husky add .husky/pre-commit "npm test"
v9

Adding husky to a project is now easier than ever. It's just a single line that does the same as above. No need to read the docs to get started anymore.

npx husky init

Adding a New Hook

v8
npx husky add  .husky/pre-commit "npm test"
git add --chmod=+x .husky/pre-commit # On Windows
v9

Adding a hook is as simple as creating a file. This can be accomplished using your favorite editor, a script or a basic echo command. For example, on Linux/macOS:

echo "npm test" > .husky/pre-commit

Further Size Reduction

v8 was already the most compact Git hooks manager at approximately 6kB.

v9 takes this a step further, reducing the size to just 3kB, likely making it the smallest devDependency in your toolkit.

To give you an idea of how small it is, the biggest file in the project is the MIT license 😄

More to Come

Additional features are in the pipeline for v9. Stay tuned 🙌

Other Changes

  • Enhanced security with CI and npm --provenance for safer publishing.
  • Added $XDG_CONFIG_HOME support. Move ~/.huskyrc to ~/.config/husky/init.sh for centralized configuration.
  • Fixed permission issue for Windows-created hooks; they no longer need to be executable.
  • Removed husky install. Use husky or husky some/dir for the same functionality (deprecation notice to be added).
  • Modified behavior when .git is missing; it now triggers a warning instead of failure.
  • Replaced HUSKY_DEBUG=1 with HUSKY=2 for debugging.
  • Updated the Husky API for module usage.
  • Transitioned to ESM for module usage.
  • Dropped support for Node 14 and 16.
  • Revamped docs.

How to Migrate

v9 is backward compatible with v8, allowing you to freely upgrade and migrate your hooks later.

Here are the steps to migrate:

package.json

{
  "scripts": {
-   "prepare": "husky install"
+   "prepare": "husky"
  }
}

.husky/pre-commit

- #!/usr/bin/env sh
- . "$(dirname -- "$0")/_/husky.sh"
npm test 

Note: sh will be used to run hooks, even if a shebang is set.

If you were using husky as a module:

- const husky = require('husky')
- // ...
+ import husky from 'husky'
+ console.log(husky())

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 21d9f75 to 18b7a8d Compare November 19, 2024 19:47
@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 18b7a8d to 52061a6 Compare October 21, 2025 16:10
@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 52061a6 to 87af343 Compare November 11, 2025 02:04
@claude

claude Bot commented Nov 11, 2025

Copy link
Copy Markdown

Pull Request Review: Husky v8 → v9 Migration

Overview

This PR updates Husky from v8.0.1 to v9.0.0, which is a major version upgrade with breaking changes. While the dependency update itself is straightforward, this PR is incomplete and will cause issues in the current state.


Critical Issues ⚠️

1. Breaking Change: postinstall Script Must Be Updated

Location: package.json:24

The current configuration uses the deprecated v8 syntax:

"postinstall": "husky install"

Required change for v9:

"prepare": "husky"

Impact: Without this change, husky won't be initialized properly after npm install, and git hooks won't work.


2. Husky Hook Files Need Migration

Locations: .husky/commit-msg and .husky/pre-commit

Both hook files contain deprecated v8 code that v9 automatically handles. The first two lines (shebang and husky.sh source) should be removed.

Files to update:

  • .husky/commit-msg (lines 1-2)
  • .husky/pre-commit (lines 1-2)

Recommendations

Priority 1: Required Changes

  1. Update package.json script: Change "postinstall": "husky install" to "prepare": "husky"
  2. Migrate hook files: Remove the first 2 lines from both hook files
  3. Test after migration: Clean install and verify hooks work

Priority 2: Best Practices

  • The GitHub workflow runs yarn install --ignore-engines which will trigger the prepare script
  • Verify hooks don't cause issues in CI environment

Security Considerations

No security concerns - Husky v9 includes enhanced security with CI and npm provenance

Performance Impact

Positive - Package size reduced from ~6kB to ~3kB, slightly faster hook execution

Test Coverage

⚠️ Manual testing required - Test pre-commit hook triggers GrumPHP and commit-msg hook works

Code Quality

Clean dependency update - Renovate bot properly updated version and lockfile


Migration Checklist

  • Update package.json to change postinstallprepare and command to just husky
  • Remove deprecated lines from .husky/commit-msg
  • Remove deprecated lines from .husky/pre-commit
  • Test locally after clean install
  • Verify pre-commit hook runs GrumPHP
  • Verify commit-msg hook works

Verdict:Changes Required Before Merge

This PR updates the dependency correctly, but the repository configuration needs to be updated to match Husky v9's breaking changes. Without the required migrations listed above, git hooks will not function properly after merging.

@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 87af343 to bc2b034 Compare November 11, 2025 07:49
@claude

claude Bot commented Nov 11, 2025

Copy link
Copy Markdown

Pull Request Review: Husky v8 → v9 Migration

Summary

This PR updates husky from ^8.0.1 to ^9.0.0. This is a major version upgrade with breaking changes that require migration steps before merging.


Critical Issues - Migration Required

1. Deprecated Hook Format (package.json:24)
The postinstall script uses the deprecated v8 command. It must be changed from husky install to just husky.

2. Deprecated Hook Syntax (.husky/pre-commit:1-2, .husky/commit-msg:1-2)
Both hooks use the deprecated v8 format with shebang and husky.sh sourcing. These lines must be completely removed in v9.


Migration Checklist

  • Update package.json script: postinstall: husky installpostinstall: husky
  • Remove shebang and husky.sh sourcing from .husky/pre-commit (lines 1-2)
  • Remove shebang and husky.sh sourcing from .husky/commit-msg (lines 1-2)
  • Test hooks work correctly after migration

Positive Aspects

  1. Size Reduction: Husky v9 is ~3kB (down from ~6kB)
  2. Simplified API: No more husky install
  3. Better Windows Support: Hooks no longer need executable permissions
  4. Enhanced security with CI and npm provenance

Additional Suggestions

The commit-msg hook appears empty. Consider adding commitlint integration since you have @commitlint packages installed.


Verdict

Do Not Merge without completing the migration steps. The update is beneficial but requires configuration changes to work properly with v9.

@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from bc2b034 to e57cb30 Compare December 31, 2025 16:36
@claude

claude Bot commented Dec 31, 2025

Copy link
Copy Markdown

Code Review - Husky v8 to v9 Upgrade

Thank you for the automated dependency update! This PR upgrades husky from v8 to v9.

Breaking Changes - Migration Required

This PR only updates the dependency version but does not include the required migration steps for husky v9. The current setup will continue to work due to backward compatibility, but there are deprecated patterns that need to be addressed.

Required Migration Steps

1. Update package.json scripts (line 24)

The postinstall script needs updating:

  • Old: "postinstall": "husky install"
  • New: "postinstall": "husky"

2. Update hook files

Both .husky/commit-msg and .husky/pre-commit contain deprecated code (lines 1-2) that will be removed in v10. Remove these lines:

  • #!/bin/sh
  • . "$(dirname "$0")/_/husky.sh"

In v9, hooks no longer need the shebang or husky.sh sourcing. Hooks are executed with sh automatically.

Code Quality Assessment

Positive aspects:

  • Dependency update follows semantic versioning
  • Husky v9 is more secure (CI + npm provenance)
  • Smaller bundle size (6kB to 3kB)
  • Adds XDG_CONFIG_HOME support
  • Fixes Windows permission issues

Issues identified:

  • Migration steps not included
  • Deprecated code patterns still present
  • Empty commit-msg hook should be reviewed

Potential Bugs and Issues

  1. Deprecated patterns: Current hooks use deprecated v8 patterns. While they work now, they will fail in v10.

  2. Empty commit-msg hook: The .husky/commit-msg file is empty except for deprecated boilerplate. Consider if this hook is needed, or if commitlint should be integrated.

Performance Considerations

  • Package size reduction (6kB to 3kB) is beneficial
  • No runtime performance impact expected

Security Concerns

  • v9 includes enhanced security with CI and npm provenance
  • No security issues introduced
  • Pre-commit hook properly executes GrumPHP for code quality checks

Test Coverage

  • Manual testing recommended after migration
  • Test that pre-commit hook runs GrumPHP on commit
  • Verify hook execution with new v9 behavior
  • Test on both Unix and Windows environments

Recommendations

  1. Complete the migration: Update package.json and hook files as shown above
  2. Review commit-msg hook: Decide if it should be removed or if commitlint should be integrated (commitlint is in dependencies)
  3. Test the migration: Verify hooks work correctly after changes
  4. Documentation: Consider documenting the husky setup for contributors

Conclusion

Recommendation: Request changes before merging

While the dependency update is fine, the PR is incomplete without migration steps. The code will work due to backward compatibility, but leaves deprecated code that will break in v10.

Suggested action: Either add the migration changes to this PR, or merge and create a follow-up PR to complete the migration.


Review generated by Claude Code

@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from e57cb30 to 315d52e Compare January 8, 2026 22:34
@claude

claude Bot commented Jan 8, 2026

Copy link
Copy Markdown

Code Review: Husky v8 → v9 Upgrade

Summary

This PR upgrades the husky dependency from v8.0.1 to v9.0.0. While the package.json change itself is minimal (1 line), this is a breaking change that requires additional migration steps to work properly.

Critical Issues

1. Incomplete Migration - Hooks Will Break

The existing husky hooks use deprecated v8 syntax that is incompatible with v9. The hooks contain these deprecated lines that need removal:

  • .husky/commit-msg (line 1-2)
  • .husky/pre-commit (line 1-2)

2. Package.json Script Needs Update

The postinstall script in package.json:24 uses the deprecated husky install command and must be changed to just husky.

Required Migration Steps

  1. Update package.json scripts.postinstall from "husky install" to "husky"
  2. Remove the first 3 lines from .husky/commit-msg (the shebang and husky.sh source line)
  3. Remove the first 3 lines from .husky/pre-commit (the shebang and husky.sh source line)

These deprecated lines will be automatically removed by husky v9 on first run, but its better to do it explicitly in this PR.

@claude

claude Bot commented Jan 8, 2026

Copy link
Copy Markdown

Positive Aspects

  1. Security improvements: v9 includes enhanced security with CI and npm provenance
  2. Size reduction: v9 is 50% smaller (3kB vs 6kB)
  3. Better Windows support: Fixed permission issues for Windows-created hooks
  4. Backward compatibility: v9 is designed to be backward compatible during migration
  5. Active maintenance: Husky v9 has received numerous bug fixes and improvements since release

Testing Recommendations

After applying the migration changes:

  1. Fresh install: rm -rf node_modules bun.lockb && bun install
  2. Hook execution: Make a test commit to verify pre-commit hook runs GrumPHP correctly
  3. Commit message validation: Test commit-msg hook functionality
  4. CI/CD: Ensure CI pipelines still work with updated husky

Recommendation

Do not merge as-is. The PR needs additional commits to complete the husky v9 migration. Without these changes, git hooks will either show deprecation warnings and auto-remove the deprecated code (causing confusion) or potentially fail to execute properly in husky v10.

I recommend updating this PR with the migration changes above.

References:

@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 315d52e to 3e2e536 Compare February 2, 2026 14:44
@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 3e2e536 to 56087ba Compare March 26, 2026 18:40
@renovate
renovate Bot force-pushed the renovate/husky-9.x branch from 56087ba to b9676c8 Compare July 25, 2026 23:59
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.

0 participants