gpt4 book ai didi

javascript - husk 在我提交新文件时不执行预提交

转载 作者:行者123 更新时间:2023-12-04 08:46:16 26 4
gpt4 key购买 nike

关闭。这个问题需要debugging details .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

1年前关闭。




Improve this question




我正在使用 husky v4.3.0 lint-staged 10.4.0 prettier v2.1create-react-app .
包.json:

"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{ts, tsx}": [
"eslint --fix",
"git add"
],
"src/**/*.{ts, tsx, css, md, mdx, html}": [
"prettier --write",
"git add"
]
},
我发现了一个类似的问题 lint-staged not running on precommit ,我尝试了提到的不同答案,例如:
  • 删除节点模块并重新安装包
  • 使用 npm rebuild
  • 重建软件包
  • 重新安装 husky 和 ​​lint-staged

  • 每当我提交任何内容时,lint-staged 都不会执行以运行 lint 和更漂亮。
    我该如何解决?

    最佳答案

    问题是由于 git版本。我用了git v2.9.0和 husky v4 接受 git >= 2.13.0 .

    Existing hooks are kept. Requires Node >= 10 and Git >= 2.13.0.


    引用: https://github.com/typicode/husky/tree/master

    关于javascript - husk 在我提交新文件时不执行预提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64304515/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com