Skip to content

Documentation for @commitlint/format does not match function #579

Closed
@bartvanandel

Description

@bartvanandel

The current documentation for @commitlint/format is still using the old report parameter format which was in use until commit c964696. The old behavior is still used pretty much verbatim in a non-exported function named formatResult, which is actually pretty useful by itself as the output of lint(message) still uses the same format.

Note that there are more pieces of documentation which need an update, e.g. the reference API documentation is also outdated.

Expected Behavior

  • Documentation for @commitlint/format should match actual function signature
  • @commitlint/format/formatResult function is useful and should be exported, so the output of lint can be easily formatted.

Current Behavior

  • Documentation does not match function signature
  • formatResult is not exported, there is only the default which requires a full report as input
  • Output of lint can only be formatted by wrapping the parameter in an awkward way:
    const message = ...
    lint(message)
      .then(results => format({ results: [results] })
      .then(console.log);

Affected packages

  • cli
  • core
  • prompt
  • config-angular
  • config-conventional
  • docs

Context

The issue affects us because we use this formatting function in our build pipeline automation. We are currently using the workaround described above, but it's not as neat as it can be. And the only way to actually find out how to use format properly was to view the source code, the docs didn't help.

Your Environment

Executable Version
commitlint --version 7.5.0
git --version 2.20.1.windows.1
node --version v10.15.1

Metadata

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