2

我正在使用 husky 来挂钩 Git 提交消息。

commit-msg与 git CLI 一起使用时,该钩子可以正常工作。

使用 git cli 成功

但是我的主要 IDE - WebStorm 失败了。

这是错误屏幕截图。

错误画面

包.json

{
  "name": "backend",
  "version": "1.0.0",
  "private": true,
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "scripts": {
...

commitlint.config.js

/**
 * A tool to lint commit messages
 * @see https://github.com/marionebl/commitlint
 *
 * We have limited the labels of the commits to:
 *   - ADDED: new features
 *   - CHANGED: changes in existing functionality
 *   - DEPRECATED: soon-to-be removed features
 *   - REMOVED: removed features
 *   - FIXED: any bug fixes
 *   - SECURITY: in case of vulnerabilities
 */
module.exports = {
  rules: {
    "body-leading-blank": [1, "always"],
    "footer-leading-blank": [1, "always"],
    "header-max-length": [1, "always", 72],
    "scope-case": [2, "always", "lower-case"],
    "subject-case": [
      2,
      "never",
      ["sentence-case", "start-case", "pascal-case", "upper-case"],
    ],
    "subject-empty": [2, "never"],
    "subject-full-stop": [2, "never", "."],
    "type-case": [2, "always", "upper-case"],
    "type-empty": [2, "never"],
    "type-enum": [
      2,
      "always",
      ["ADDED", "CHANGED", "DEPRECATED", "REMOVED", "FIXED", "SECURITY"],
    ],
  },
}

节点版本

节点版本

知道为什么我会遇到这个错误吗?提前致谢。

PS 我通过 WSL 2.0 使用 Ubuntu 20.04。(不确定这可能是一个线索:))

在此处输入图像描述

4

0 回答 0