Skip to content

Commit 540fe06

Browse files
committed
chore: apply prettier v2.x format fixes
1 parent 3c5117d commit 540fe06

File tree

99 files changed

+494
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+494
-495
lines changed

@commitlint/cli/src/cli.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const cli = (args: string[], options: TestOptions) => {
1717
cwd: options.cwd,
1818
env: options.env,
1919
input: input,
20-
reject: false
20+
reject: false,
2121
});
2222
};
2323
};
@@ -239,7 +239,7 @@ test('should allow reading of environment variables for edit file, succeeding if
239239
await fs.writeFile(path.join(cwd, 'commit-msg-file'), 'foo');
240240
const actual = await cli(['--env', 'variable'], {
241241
cwd,
242-
env: {variable: 'commit-msg-file'}
242+
env: {variable: 'commit-msg-file'},
243243
})();
244244
expect(actual.exitCode).toBe(0);
245245
});
@@ -252,7 +252,7 @@ test('should allow reading of environment variables for edit file, failing if in
252252
);
253253
const actual = await cli(['--env', 'variable'], {
254254
cwd,
255-
env: {variable: 'commit-msg-file'}
255+
env: {variable: 'commit-msg-file'},
256256
})();
257257
expect(actual.exitCode).toBe(1);
258258
});

@commitlint/cli/src/cli.ts

+29-33
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
ParserOptions,
1515
ParserPreset,
1616
QualifiedConfig,
17-
Formatter
17+
Formatter,
1818
} from '@commitlint/types';
1919
import {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

274274
function 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];

@commitlint/core/src/core.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export = {
77
format,
88
load,
99
lint,
10-
read
10+
read,
1111
};

@commitlint/ensure/src/index.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ import * as ensure from '.';
66
test('exports all checkers', async () => {
77
const ignore = ['types'];
88
const expected = (await glob('*.ts'))
9-
.map(f => camelCase(f))
9+
.map((f) => camelCase(f))
1010
.sort()
11-
.filter(item => !ignore.includes(item));
11+
.filter((item) => !ignore.includes(item));
1212
const actual = Object.keys(ensure).sort();
1313
expect(actual).toEqual(expected);
1414
});
1515

1616
test('rules export functions', () => {
1717
const actual = Object.values(ensure);
18-
expect(actual.every(rule => typeof rule === 'function')).toBe(true);
18+
expect(actual.every((rule) => typeof rule === 'function')).toBe(true);
1919
});
2020

2121
async function glob(pattern: string): Promise<string[]> {
2222
const files = await globby(pattern, {
2323
ignore: ['**/index.ts', '**/*.test.ts'],
24-
cwd: __dirname
24+
cwd: __dirname,
2525
});
2626
return files.map(relative).map(toExport);
2727
}

@commitlint/ensure/src/max-line-length.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import ensure from './max-length';
22

33
export default (value: string, max: number): boolean =>
44
typeof value === 'string' &&
5-
value.split(/\r?\n/).every(line => ensure(line, max));
5+
value.split(/\r?\n/).every((line) => ensure(line, max));

0 commit comments

Comments
 (0)