Skip to content

cli: add --print-config to print current configuration #858

Closed
@kevinoid

Description

It would be great if the commitlint cli provided an option similar to ESLint's --print-config option to print the current configuration.

Expected Behavior

commitlint --print-config

would print the current configuration, after resolving/merging any extends, to stdout as JSON. For example, with .commitlint.config.js

module.exports = {extends: ['@commitlint/config-angular']};

it would print

{
  "rules": {
    "body-leading-blank": [1, "always"],
    "footer-leading-blank": [1, "always"],
    "header-max-length": [2, "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", "lower-case"],
    "type-empty": [2, "never"],
    "type-enum": [
      "build",
      "ci",
      "docs",
      "feat",
      "fix",
      "perf",
      "refactor",
      "revert",
      "style",
      "test"
   ]
  }
}

Current Behavior

I have not seen such an option mentioned.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Context

My current use case is to provide autocompletion of types and scopes from the commitlint configuration while editing commit messages.

Thanks for considering,
Kevin

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions