@@ -14,7 +14,7 @@ import {
14
14
ParserOptions ,
15
15
ParserPreset ,
16
16
QualifiedConfig ,
17
- Formatter
17
+ Formatter ,
18
18
} from '@commitlint/types' ;
19
19
import { CliError } from './cli-error' ;
20
20
@@ -26,77 +26,77 @@ const cli = yargs
26
26
alias : 'c' ,
27
27
default : true ,
28
28
description : 'toggle colored output' ,
29
- type : 'boolean'
29
+ type : 'boolean' ,
30
30
} ,
31
31
config : {
32
32
alias : 'g' ,
33
33
description : 'path to the config file' ,
34
- type : 'string'
34
+ type : 'string' ,
35
35
} ,
36
36
cwd : {
37
37
alias : 'd' ,
38
38
default : process . cwd ( ) ,
39
39
defaultDescription : '(Working Directory)' ,
40
40
description : 'directory to execute in' ,
41
- type : 'string'
41
+ type : 'string' ,
42
42
} ,
43
43
edit : {
44
44
alias : 'e' ,
45
45
default : false ,
46
46
description :
47
47
'read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG' ,
48
- type : 'string'
48
+ type : 'string' ,
49
49
} ,
50
50
env : {
51
51
alias : 'E' ,
52
52
description :
53
53
'check message in the file at path given by environment variable value' ,
54
- type : 'string'
54
+ type : 'string' ,
55
55
} ,
56
56
extends : {
57
57
alias : 'x' ,
58
58
description : 'array of shareable configurations to extend' ,
59
- type : 'array'
59
+ type : 'array' ,
60
60
} ,
61
61
'help-url' : {
62
62
alias : 'H' ,
63
63
type : 'string' ,
64
- description : 'help url in error message'
64
+ description : 'help url in error message' ,
65
65
} ,
66
66
from : {
67
67
alias : 'f' ,
68
68
description :
69
69
'lower end of the commit range to lint; applies if edit=false' ,
70
- type : 'string'
70
+ type : 'string' ,
71
71
} ,
72
72
format : {
73
73
alias : 'o' ,
74
74
description : 'output format of the results' ,
75
- type : 'string'
75
+ type : 'string' ,
76
76
} ,
77
77
'parser-preset' : {
78
78
alias : 'p' ,
79
79
description :
80
80
'configuration preset to use for conventional-commits-parser' ,
81
- type : 'string'
81
+ type : 'string' ,
82
82
} ,
83
83
quiet : {
84
84
alias : 'q' ,
85
85
default : false ,
86
86
description : 'toggle console output' ,
87
- type : 'boolean'
87
+ type : 'boolean' ,
88
88
} ,
89
89
to : {
90
90
alias : 't' ,
91
91
description :
92
92
'upper end of the commit range to lint; applies if edit=false' ,
93
- type : 'string'
93
+ type : 'string' ,
94
94
} ,
95
95
verbose : {
96
96
alias : 'V' ,
97
97
type : 'boolean' ,
98
- description : 'enable verbose output for reports without problems'
99
- }
98
+ description : 'enable verbose output for reports without problems' ,
99
+ } ,
100
100
} )
101
101
. version (
102
102
'version' ,
@@ -112,7 +112,7 @@ const cli = yargs
112
112
)
113
113
. strict ( ) ;
114
114
115
- main ( cli . argv ) . catch ( err => {
115
+ main ( cli . argv ) . catch ( ( err ) => {
116
116
setTimeout ( ( ) => {
117
117
if ( err . type === pkg . name ) {
118
118
process . exit ( 1 ) ;
@@ -132,12 +132,12 @@ async function main(options: CliFlags) {
132
132
to : flags . to ,
133
133
from : flags . from ,
134
134
edit : flags . edit ,
135
- cwd : flags . cwd
135
+ cwd : flags . cwd ,
136
136
} ) ) ;
137
137
138
138
const messages = ( Array . isArray ( input ) ? input : [ input ] )
139
- . filter ( message => typeof message === 'string' )
140
- . filter ( message => message . trim ( ) !== '' )
139
+ . filter ( ( message ) => typeof message === 'string' )
140
+ . filter ( ( message ) => message . trim ( ) !== '' )
141
141
. filter ( Boolean ) ;
142
142
143
143
if ( messages . length === 0 && ! checkFromRepository ( flags ) ) {
@@ -157,7 +157,7 @@ async function main(options: CliFlags) {
157
157
parserOpts : { } ,
158
158
plugins : { } ,
159
159
ignores : [ ] ,
160
- defaultIgnores : true
160
+ defaultIgnores : true ,
161
161
} ;
162
162
if ( parserOpts ) {
163
163
opts . parserOpts = parserOpts ;
@@ -179,7 +179,7 @@ async function main(options: CliFlags) {
179
179
}
180
180
181
181
const results = await Promise . all (
182
- messages . map ( message => lint ( message , loaded . rules , opts ) )
182
+ messages . map ( ( message ) => lint ( message , loaded . rules , opts ) )
183
183
) ;
184
184
185
185
if ( Object . keys ( loaded . rules ) . length === 0 ) {
@@ -199,12 +199,12 @@ async function main(options: CliFlags) {
199
199
message : [
200
200
'Please add rules to your `commitlint.config.js`' ,
201
201
' - Getting started guide: https://git.io/fhHij' ,
202
- ' - Example config: https://git.io/fhHip'
203
- ] . join ( '\n' )
204
- }
202
+ ' - Example config: https://git.io/fhHip' ,
203
+ ] . join ( '\n' ) ,
204
+ } ,
205
205
] ,
206
206
warnings : [ ] ,
207
- input
207
+ input,
208
208
} ) ;
209
209
}
210
210
@@ -226,7 +226,7 @@ async function main(options: CliFlags) {
226
226
valid : true ,
227
227
errorCount : 0 ,
228
228
warningCount : 0 ,
229
- results : [ ]
229
+ results : [ ] ,
230
230
}
231
231
) ;
232
232
@@ -235,7 +235,7 @@ async function main(options: CliFlags) {
235
235
verbose : flags . verbose ,
236
236
helpUrl : flags [ 'help-url' ]
237
237
? flags [ 'help-url' ] . trim ( )
238
- : 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
238
+ : 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint' ,
239
239
} ) ;
240
240
241
241
if ( ! flags . quiet && output !== '' ) {
@@ -267,19 +267,15 @@ function normalizeFlags(flags: CliFlags): CliFlags {
267
267
const edit = getEditValue ( flags ) ;
268
268
return {
269
269
...flags ,
270
- edit
270
+ edit,
271
271
} ;
272
272
}
273
273
274
274
function getEditValue ( flags : CliFlags ) {
275
275
if ( flags . env ) {
276
276
if ( ! ( flags . env in process . env ) ) {
277
277
throw new Error (
278
- `Recieved '${
279
- flags . env
280
- } ' as value for -E | --env, but environment variable '${
281
- flags . env
282
- } ' is not available globally`
278
+ `Recieved '${ flags . env } ' as value for -E | --env, but environment variable '${ flags . env } ' is not available globally`
283
279
) ;
284
280
}
285
281
return process . env [ flags . env ] ;
0 commit comments