哈士奇预提交错误 --no-stash 选项已重命名为 --no-reset

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

我在项目中提交和使用 Husky 时遇到问题。

这是我在提交 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)

我使用的 Husky 版本是 7.0.4,这是预提交挂钩文件

#!/bin/sh
. "$(dirname "[=11=]")/_/husky.sh"

npx lint-staged
npx pretty-quick --staged

知道问题出在哪里吗?

提前致谢!

这应该来自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.

好像是警告,不是阻塞问题。

尝试使用明确添加的选项调用它:

npx lint-staged --noreset=false

我遇到的问题似乎是格式错误的 package.json(多了一个逗号)。

这导致 linter 失败,尽管输出中没有出现关于它的错误。

删除多余的逗号后,我可以再次提交 :)