@@ -14,7 +14,7 @@ import {
1414 ParserOptions ,
1515 ParserPreset ,
1616 QualifiedConfig ,
17- Formatter
17+ Formatter ,
1818} from '@commitlint/types' ;
1919import { CliError } from './cli-error' ;
2020
@@ -26,77 +26,77 @@ const cli = yargs
2626 alias : 'c' ,
2727 default : true ,
2828 description : 'toggle colored output' ,
29- type : 'boolean'
29+ type : 'boolean' ,
3030 } ,
3131 config : {
3232 alias : 'g' ,
3333 description : 'path to the config file' ,
34- type : 'string'
34+ type : 'string' ,
3535 } ,
3636 cwd : {
3737 alias : 'd' ,
3838 default : process . cwd ( ) ,
3939 defaultDescription : '(Working Directory)' ,
4040 description : 'directory to execute in' ,
41- type : 'string'
41+ type : 'string' ,
4242 } ,
4343 edit : {
4444 alias : 'e' ,
4545 default : false ,
4646 description :
4747 'read last commit message from the specified file or fallbacks to ./.git/COMMIT_EDITMSG' ,
48- type : 'string'
48+ type : 'string' ,
4949 } ,
5050 env : {
5151 alias : 'E' ,
5252 description :
5353 'check message in the file at path given by environment variable value' ,
54- type : 'string'
54+ type : 'string' ,
5555 } ,
5656 extends : {
5757 alias : 'x' ,
5858 description : 'array of shareable configurations to extend' ,
59- type : 'array'
59+ type : 'array' ,
6060 } ,
6161 'help-url' : {
6262 alias : 'H' ,
6363 type : 'string' ,
64- description : 'help url in error message'
64+ description : 'help url in error message' ,
6565 } ,
6666 from : {
6767 alias : 'f' ,
6868 description :
6969 'lower end of the commit range to lint; applies if edit=false' ,
70- type : 'string'
70+ type : 'string' ,
7171 } ,
7272 format : {
7373 alias : 'o' ,
7474 description : 'output format of the results' ,
75- type : 'string'
75+ type : 'string' ,
7676 } ,
7777 'parser-preset' : {
7878 alias : 'p' ,
7979 description :
8080 'configuration preset to use for conventional-commits-parser' ,
81- type : 'string'
81+ type : 'string' ,
8282 } ,
8383 quiet : {
8484 alias : 'q' ,
8585 default : false ,
8686 description : 'toggle console output' ,
87- type : 'boolean'
87+ type : 'boolean' ,
8888 } ,
8989 to : {
9090 alias : 't' ,
9191 description :
9292 'upper end of the commit range to lint; applies if edit=false' ,
93- type : 'string'
93+ type : 'string' ,
9494 } ,
9595 verbose : {
9696 alias : 'V' ,
9797 type : 'boolean' ,
98- description : 'enable verbose output for reports without problems'
99- }
98+ description : 'enable verbose output for reports without problems' ,
99+ } ,
100100 } )
101101 . version (
102102 'version' ,
@@ -112,7 +112,7 @@ const cli = yargs
112112 )
113113 . strict ( ) ;
114114
115- main ( cli . argv ) . catch ( err => {
115+ main ( cli . argv ) . catch ( ( err ) => {
116116 setTimeout ( ( ) => {
117117 if ( err . type === pkg . name ) {
118118 process . exit ( 1 ) ;
@@ -132,12 +132,12 @@ async function main(options: CliFlags) {
132132 to : flags . to ,
133133 from : flags . from ,
134134 edit : flags . edit ,
135- cwd : flags . cwd
135+ cwd : flags . cwd ,
136136 } ) ) ;
137137
138138 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 ( ) !== '' )
141141 . filter ( Boolean ) ;
142142
143143 if ( messages . length === 0 && ! checkFromRepository ( flags ) ) {
@@ -157,7 +157,7 @@ async function main(options: CliFlags) {
157157 parserOpts : { } ,
158158 plugins : { } ,
159159 ignores : [ ] ,
160- defaultIgnores : true
160+ defaultIgnores : true ,
161161 } ;
162162 if ( parserOpts ) {
163163 opts . parserOpts = parserOpts ;
@@ -179,7 +179,7 @@ async function main(options: CliFlags) {
179179 }
180180
181181 const results = await Promise . all (
182- messages . map ( message => lint ( message , loaded . rules , opts ) )
182+ messages . map ( ( message ) => lint ( message , loaded . rules , opts ) )
183183 ) ;
184184
185185 if ( Object . keys ( loaded . rules ) . length === 0 ) {
@@ -199,12 +199,12 @@ async function main(options: CliFlags) {
199199 message : [
200200 'Please add rules to your `commitlint.config.js`' ,
201201 ' - 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+ } ,
205205 ] ,
206206 warnings : [ ] ,
207- input
207+ input,
208208 } ) ;
209209 }
210210
@@ -226,7 +226,7 @@ async function main(options: CliFlags) {
226226 valid : true ,
227227 errorCount : 0 ,
228228 warningCount : 0 ,
229- results : [ ]
229+ results : [ ] ,
230230 }
231231 ) ;
232232
@@ -235,7 +235,7 @@ async function main(options: CliFlags) {
235235 verbose : flags . verbose ,
236236 helpUrl : flags [ 'help-url' ]
237237 ? flags [ 'help-url' ] . trim ( )
238- : 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
238+ : 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint' ,
239239 } ) ;
240240
241241 if ( ! flags . quiet && output !== '' ) {
@@ -267,19 +267,15 @@ function normalizeFlags(flags: CliFlags): CliFlags {
267267 const edit = getEditValue ( flags ) ;
268268 return {
269269 ...flags ,
270- edit
270+ edit,
271271 } ;
272272}
273273
274274function getEditValue ( flags : CliFlags ) {
275275 if ( flags . env ) {
276276 if ( ! ( flags . env in process . env ) ) {
277277 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`
283279 ) ;
284280 }
285281 return process . env [ flags . env ] ;
0 commit comments