Gathering detailed insights and metrics for commitlint-format
Gathering detailed insights and metrics for commitlint-format
Gathering detailed insights and metrics for commitlint-format
Gathering detailed insights and metrics for commitlint-format
npm install commitlint-format
Typescript
Module System
Node Version
NPM Version
73
Supply Chain
98.8
Quality
77.9
Maintenance
100
Vulnerability
100
License
TypeScript (95.7%)
Shell (4.3%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
31 Commits
1 Watchers
12 Branches
1 Contributors
Updated on Apr 28, 2025
Latest Version
1.0.2
Package Id
commitlint-format@1.0.2
Unpacked Size
44.51 kB
Size
9.62 kB
File Count
23
NPM Version
10.9.2
Node Version
20.19.0
Published on
Mar 29, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Variative format output.
1✉️ Commit Message 2 3commit message here 4 5✔ all good [no-problem-found] 6 7✔ Summary: found 0 errors and 0 warnings. 8 9-------------------------------------- 10 11✉️ Commit Message 12 13commit message here 14 15⚠ warning message [rule-name] 16 17⚠ Summary: found 0 errors and 1 warnings. 18 19Help: help-url-here 20 21-------------------------------------- 22 23✉️ Commit Message 24 25commit message here 26 27✖ error message [rule-name] 28 29✖ Summary: found 1 errors and 0 warnings. 30 31Help: help-url-here 32 33-------------------------------------- 34 35✖ Lint 3 commits. Found 1 errors and 1 warnings.
1⧗ input: commit message here 2✔ found 0 problems, 0 warnings 3⧗ input: commit message here 4⚠ warning message [rule-name] 5 6⚠ found 0 problems, 1 warnings 7ⓘ Get help: help-url-here 8 9⧗ input: commit message here 10✖ error message [rule-name] 11 12✖ found 1 problems, 0 warnings 13ⓘ Get help: help-url-here
1[ 2 { 3 "input": "commit message here", 4 "problems": [], 5 "summary": { 6 "sign": "✔", 7 "errorCount": 0, 8 "warningCount": 0 9 }, 10 "helpUrl": "https://github.com/conventional-changelog/commitlint/#what-is-commitlint" 11 }, 12 { 13 "input": "commit message here", 14 "problems": [ 15 { 16 "level": 1, 17 "message": "warning message", 18 "name": "rule-name", 19 "valid": true, 20 "sign": "⚠" 21 } 22 ], 23 "summary": { 24 "sign": "⚠", 25 "errorCount": 0, 26 "warningCount": 1 27 }, 28 "helpUrl": "https://github.com/conventional-changelog/commitlint/#what-is-commitlint" 29 }, 30 { 31 "input": "commit message here", 32 "problems": [ 33 { 34 "level": 2, 35 "message": "error message", 36 "name": "rule-name", 37 "valid": false, 38 "sign": "✖" 39 } 40 ], 41 "summary": { 42 "sign": "✖", 43 "errorCount": 1, 44 "warningCount": 0 45 }, 46 "helpUrl": "https://github.com/conventional-changelog/commitlint/#what-is-commitlint" 47 } 48]
1[{"input":"commit message here","problems":[],"summary":{"sign":"✔","errorCount":0,"warningCount":0},"helpUrl":"https://github.com/conventional-changelog/commitlint/#what-is-commitlint"},{"input":"commit message here","problems":[{"level":1,"message":"warning message","name":"rule-name","valid":true,"sign":"⚠"}],"summary":{"sign":"⚠","errorCount":0,"warningCount":1},"helpUrl":"https://github.com/conventional-changelog/commitlint/#what-is-commitlint"},{"input":"commit message here","problems":[{"level":2,"message":"error message","name":"rule-name","valid":false,"sign":"✖"}],"summary":{"sign":"✖","errorCount":1,"warningCount":0},"helpUrl":"https://github.com/conventional-changelog/commitlint/#what-is-commitlint"}]
1::debug::✉️ Commit Message%0A%0Acommit message here%0A%0A✔ all good [no-problem-found]%0A%0A✔ Summary: found 0 errors and 0 warnings. 2::warning::✉️ Commit Message%0A%0Acommit message here%0A%0A⚠ warning message [rule-name]%0A%0A⚠ Summary: found 0 errors and 1 warnings.%0A%0AHelp: https://github.com/conventional-changelog/commitlint/#what-is-commitlint. 3::error::✉️ Commit Message%0A%0Acommit message here%0A%0A✖ error message [rule-name]%0A%0A✖ Summary: found 1 errors and 0 warnings.%0A%0AHelp: https://github.com/conventional-changelog/commitlint/#what-is-commitlint.
See [custom formatter usage](#custom-formatter).
Customizable format options.
Fully typed with typescript.
Well tested.
Follow @commitlint installation instruction first, and then
1# NPM 2npm install --save-dev commitlint-format 3 4# BUN 5bun add -d commitlint-format
Add commitlint-format
or commitlint-format/*formatter
to formatter
field inside commitlint configuration.
Available *formatter:
1// .commitlintrc.json 2{ 3 "formatter": "commitlint-format" 4}
It will use default
formatter and has the same result as commitlint-format/default
.
To make it simple, use javascript or typescript commitlint configuration.
1// commitlint.config.js 2import { formatter } from 'commitlint-format/default'; 3 4formatter.setFormatOptions({ 5 color: false, 6 verbose: true 7}); 8 9export default { 10 formatter: 'commitlint-format/default' 11};
Available format options:
1type FormatOptions = { 2 /** 3 * Color the output. 4 */ 5 color?: boolean; 6 7 /** 8 * Signs to use as decoration for messages with severity 0, 1, 2. 9 */ 10 signs?: readonly [string, string, string]; 11 12 /** 13 * Colors to use for messages with severity 0, 1, 2. 14 */ 15 colors?: readonly [string, string, string]; 16 17 /** 18 * Print summary and inputs for reports without problems. 19 */ 20 verbose?: boolean; 21 22 /** 23 * URL to print as help for reports with problems. 24 */ 25 helpUrl?: string; 26 27 /** 28 * Prefix to be used for formatted report. 29 * Only affects `format` method. 30 */ 31 prefix?: string; 32 33 /** 34 * Suffix to be used for formatted report. 35 * Only affects `format` method. 36 */ 37 suffix?: string; 38 39 /** 40 * Prefix to be used each formatted commit result in the report. 41 * Only affects `format` method. 42 */ 43 eachCommitPrefix?: string; 44 45 /** 46 * Suffix to be used each formatted commit result in the report (added before separatorBetweenCommits text). 47 * Only affects `format` method. 48 */ 49 eachCommitSuffix?: string; 50 51 /** 52 * Separator to be used between each commit in the report. 53 * Only affects `format` method. 54 * Defaults to `\n`. 55 */ 56 separatorBetweenCommits?: string; 57 58 /** 59 * Separator to be used between formatted input and formatted result. 60 * Only affects `format` method and if `formatInput` not resulting empty. 61 * Defaults to `\n`. 62 */ 63 separatorBetweenInputAndResult?: string; 64 65 /** 66 * Finalizing result. 67 * Only for `format` method. 68 */ 69 finalizeFormatResult?: ( 70 formatted: string, 71 context: { 72 /** Options used for formatting. */ 73 formatOptions: FormatOptions; 74 /** The `chalk` instance used for styling the output. */ 75 chalk: ChalkInstance; 76 /** Whether formatting with verbose or not */ 77 verbose: boolean; 78 /** A function that retrieves the appropriate sign (e.g., ✔, ⚠, ✖) based on the linting level. */ 79 getSign: (level: 0 | 1 | 2) => string; 80 }, 81 summary: { 82 totalCommit: number; 83 totalError: number; 84 totalWarning: number; 85 } 86 ) => string 87}
The simplest way is by leveraging commitlint-format/custom
, the only customizable formatter.
1// commitlint.config.js 2import { formatter } from 'commitlint-format/custom'; 3 4formatter.setTransformer({ 5 /** Function to transform the input (commit message) of the linting result. */ 6 transformInput: (result, context) => { 7 // add transform input logic here.. 8 return []; 9 }, 10 /** Function to transform the final linting result output. */ 11 transformResult: (result, context) => { 12 // add transform result logic here.. 13 return []; 14 } 15}); 16 17export default { 18 formatter: 'commitlint-format/custom' 19};
or by creating new formatter instance.
1// custom-format.js 2import { Blueprint } from 'commitlint-format'; 3import { Chalk } from 'chalk'; 4 5const formatter = new Blueprint.Formatter( 6 { 7 /** Function to transform the input (commit message) of the linting result. */ 8 transformInput: (result, context) => { 9 // add transform input logic here.. 10 return []; 11 }, 12 /** Function to transform the final linting result output. */ 13 transformResult: (result, context) => { 14 // add transform result logic here.. 15 return []; 16 } 17 }, 18 new Chalk(), 19 { 20 customizable: true, 21 formatOptions: { 22 signs: ['.', '?', '!'] 23 } 24 } 25); 26 27export default formatter.format;
and use it in commitlint configuration.
1// .commitlintrc.json 2{ 3 "formatter": "./custom-format.js" 4}
The code in this project is released under the MIT License.
No vulnerabilities found.
No security vulnerabilities found.