Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@commitlint/format
Advanced tools
@commitlint/format is a package used to format commit messages according to specified rules. It is part of the commitlint suite, which helps enforce consistent commit message conventions.
Format Commit Messages
This feature allows you to format the results of commit message linting. The `format` function takes an object with a `results` array and returns a formatted string that can be logged or displayed.
const { format } = require('@commitlint/format');
const results = [
{ valid: true, errors: [], warnings: [] },
{ valid: false, errors: [{ message: 'type may not be empty' }], warnings: [] }
];
const output = format({ results });
console.log(output);
Commitizen is a tool that helps you write consistent commit messages by providing an interactive prompt. Unlike @commitlint/format, which focuses on formatting and linting commit messages, Commitizen guides you through the process of writing them.
Conventional Changelog is a tool that generates changelogs based on commit messages that follow a specific convention. While @commitlint/format is used for formatting commit messages, Conventional Changelog focuses on generating changelogs from those messages.
Semantic Release automates the versioning and package publishing process based on commit messages. It uses commit message conventions to determine the type of release. Unlike @commitlint/format, which is used for formatting commit messages, Semantic Release automates the release process.
Format commitlint reports
npm install --save @commitlint/format
const format = require('@commitlint/format');
const output = format(
{
valid: false,
errorCount: 1,
warningCount: 1,
results: [
{
valid: false,
input: 'some: commit message',
errors: [
{
valid: false,
level: 2,
name: 'some-error',
message: 'This will show up red as it has level 2'
}
],
warnings: [
{
valid: true,
level: 0,
name: 'some-hint',
message: 'This will not show up as it has level 0'
},
{
valid: false,
level: 1,
name: 'some-warning',
message: 'This will show up yellow as it has level 1'
}
]
}
]
},
{
color: false
}
);
process.stdout.write(output);
/* => [
'✖ This will show up red as it has level 2 [some-error]',
' This will not show up as it has level 0 [some-hint]',
'⚠ This will show up yellow as it has level 1 [some-warning]',
'✖ found 1 problems, 2 warnings'
] */
Consult docs/api for comprehensive documentation.
FAQs
Format commitlint reports
The npm package @commitlint/format receives a total of 2,590,966 weekly downloads. As such, @commitlint/format popularity was classified as popular.
We found that @commitlint/format demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.