Skip to content

"trailer-exists" rule not recognized as a valid rule #3033

Closed
@ND56

Description

@ND56

Documentation states that a trailer-exists rule is valid, but commitlint does not recognize it as a valid rule name.

Expected Behavior

Based on the documentation, I expected to be able to add this rule to my commitlint config to verify that the footer of a commit is always prefaced by something; e.g., like this:

const Configuration = {
  /*
   * Resolve and load @commitlint/config-conventional from node_modules.
   * Referenced packages must be installed
   */
  extends: ["@commitlint/config-conventional"],
  /*
   * Any rules defined here will override rules from @commitlint/config-conventional
   */
  rules: {
    "trailer-exists": [2, "always", "Jira:"],
  },
};

Current Behavior

Currently, I get this error when I attempt to commit my code and trigger that rule (stating that trailer-exists is not an accepted rule):

RangeError: Found invalid rule names: trailer-exists. Supported rule names are: body-case, body-empty, body-leading-blank, body-max-length, body-max-line-length, body-min-length, footer-empty, footer-leading-blank, footer-max-length, footer-max-line-length, footer-min-length, header-case, header-full-stop, header-max-length, header-min-length, references-empty, scope-case, scope-empty, scope-enum, scope-max-length, scope-min-length, signed-off-by, subject-case, subject-empty, subject-full-stop, subject-max-length, subject-min-length, type-case, type-empty, type-enum, type-max-length, type-min-length
    at Object.<anonymous> (/Users/ndrew/.cache/pre-commit/repo47fm2bwy/node_env-default/lib/node_modules/commitlint-pre-commit-hook/node_modules/@commitlint/lint/lib/index.js:76:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

My Environment

Executable Version
commitlint --version @commitlint/cli": "^16.2.1"
git --version git version 2.32.0 (Apple Git-132)
node --version Node.js v17.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions