Home > OS >  husky pre commit error the --no-stash option has been renamed to --no-reset
husky pre commit error the --no-stash option has been renamed to --no-reset

Time:01-18

I am having an issue when making a commit and using Husky in my project.

This is the error I get when I make a commit such as git commit -m "feat: test commit"

me@my-laptop whatever % git commit -m "feat: test commit" 
⚠ The `--no-stash` option has been renamed to `--no-reset`.

husky - pre-commit hook exited with code 1 (error)

The version of Husky I am using is the 7.0.4 and this is the pre-commit hook file

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

npx lint-staged
npx pretty-quick --staged

Any Idea of what could be the issue?

Thanks in advance!

CodePudding user response:

Seems like the issue I was having was a malformed package.json (it had an extra comma).

This led the linter to fail, although no errors about it appear in the output.

Once I removed the extra comma, I was able to commit again :)

CodePudding user response:

This should come from okonet/lint-staged, which mentions the renaming in PR 1023

This experimental rewrite no longer uses git stashing, thus increasing performance.

It also renames the --no-stash option to --no-reset, but leaves the former as a hidden option (with warning) for backwards compatibility.

It seems to be a warning, not a blocking issue.

Try and call it with the option explicitly added:

npx lint-staged --noreset=false
  •  Tags:  
  • Related