Skip to content

Commit 9be3501

Browse files
byCedricmarionebl
authored andcommitted
docs: update example code with new report structure (#465)
1 parent baed8b1 commit 9be3501

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

Diff for: @commitlint/format/README.md

+34-18
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,44 @@ npm install --save @commitlint/format
1313
```js
1414
const format = require('@commitlint/format');
1515

16-
format({
17-
warnings: [
16+
const output = format({
17+
valid: false,
18+
errorCount: 1,
19+
warningCount: 1,
20+
results: [
1821
{
19-
level: 0,
20-
name: 'some-hint',
21-
message: 'This will not show up as it has level 0'
22-
},
23-
{
24-
level: 1,
25-
name: 'some-warning',
26-
message: 'This will show up yellow as it has level 1'
27-
}
28-
],
29-
errors: [
30-
{
31-
level: 2,
32-
name: 'some-error',
33-
message: 'This will show up red as it has level 2'
22+
valid: false,
23+
input: 'some: commit message',
24+
errors: [
25+
{
26+
valid: false,
27+
level: 2,
28+
name: 'some-error',
29+
message: 'This will show up red as it has level 2'
30+
}
31+
],
32+
warnings: [
33+
{
34+
valid: true,
35+
level: 0,
36+
name: 'some-hint',
37+
message: 'This will not show up as it has level 0'
38+
},
39+
{
40+
valid: false,
41+
level: 1,
42+
name: 'some-warning',
43+
message: 'This will show up yellow as it has level 1'
44+
}
45+
]
3446
}
35-
]
47+
]
3648
}, {
3749
color: false
3850
});
51+
52+
process.stdout.write(output);
53+
3954
/* => [
4055
'✖ This will show up red as it has level 2 [some-error]',
4156
' This will not show up as it has level 0 [some-hint]',
@@ -45,3 +60,4 @@ format({
4560
```
4661

4762
Consult [docs/api](http://marionebl.github.io/commitlint/#/reference-api) for comprehensive documentation.
63+

0 commit comments

Comments
 (0)