国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【已解決】使用 husky、commitlint 后 git commit 報(bào)錯(cuò):No staged files match any configured task.

這篇具有很好參考價(jià)值的文章主要介紹了【已解決】使用 husky、commitlint 后 git commit 報(bào)錯(cuò):No staged files match any configured task.。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。


一、問題

git commit 報(bào)錯(cuò):No staged files match any configured task.

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
[34m→[39m No staged files match any configured task.
?   input: feat: XXX
?   subject may not be empty [subject-empty]
?   type may not be empty [type-empty]

?   found 2 problems, 0 warnings
?   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

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

二、解決

這就涉及到 git hooks 了,熟悉的小伙伴自不用多說,不熟悉的可以看一下官方文檔:Git - Git 鉤子

如果報(bào)錯(cuò)中有 husky、commitlint 這樣的關(guān)鍵字眼,那就是前端項(xiàng)目中使用了這兩種 npm 插件,husky 的配置文件在如下截圖位置:

【已解決】使用 husky、commitlint 后 git commit 報(bào)錯(cuò):No staged files match any configured task.,git

  • 最粗暴的解決方式是使用 # 注釋掉最后一行(不建議,急用臨時(shí)提交可行)
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}

若是使用 JetBrains公司的系列產(chǎn)品時(shí)(WebStrom / PhpStrom / IDEA …),可以:去掉勾選(不限前端項(xiàng)目)

【已解決】使用 husky、commitlint 后 git commit 報(bào)錯(cuò):No staged files match any configured task.,git

  • 檢查 package.jsonnode_modules 該依賴是否安裝:
{
  "devDependencies": {
    "@commitlint/cli": "^17.4.4",
    "@commitlint/config-conventional": "^17.4.4",
    "husky": "^8.0.3",
  },
}

我這里最終發(fā)現(xiàn)問題就出現(xiàn)在這里( package.json 在某次代碼合并中被不知名小可愛覆蓋。。。剛好缺了 commitlint

  • 檢查提交信息是否符合規(guī)范:【筆記】項(xiàng)目?jī)?yōu)化代碼提交規(guī)范 —— commitlint+husky

若是內(nèi)網(wǎng)開發(fā),規(guī)范可見源碼:

  • node_modules\@commitlint\config-conventional\index.js
  • 檢查所有配置之后,確定沒問題的話,那么刪除 node_modules ,然后重新 npm i 試試

over文章來源地址http://www.zghlxwxcb.cn/news/detail-698289.html


三、拓展學(xué)習(xí)

到了這里,關(guān)于【已解決】使用 husky、commitlint 后 git commit 報(bào)錯(cuò):No staged files match any configured task.的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包