What is @commitlint/parse?
The @commitlint/parse package is used to parse commit messages according to the conventions used by commitlint. It takes a raw commit message string and returns a promise that resolves to an object representing the parsed commit, which includes information such as the header, type, scope, subject, body, footer, and references. This package is typically used in the context of commit message linting to ensure that commit messages follow a certain format.
What are @commitlint/parse's main functionalities?
Parsing commit messages
This feature allows you to parse a commit message and obtain an object with structured information about the commit. The code sample demonstrates how to use the parse function to parse a commit message and log the result.
const parse = require('@commitlint/parse');
const message = 'feat(scope): add new feature';
parse(message).then(commit => {
console.log(commit);
});
Other packages similar to @commitlint/parse
conventional-commits-parser
This package is similar to @commitlint/parse as it provides functionality to parse conventional commit messages. It can be used to extract metadata from commit messages following the Conventional Commits specification. It differs in its API and may offer different customization options.
commit-parser
commit-parser is another package that parses commit messages. It aims to offer a simple and lightweight solution for parsing commit messages into an object with predefined properties. It may have a different set of features and customization capabilities compared to @commitlint/parse.