Skip to content

Commit 173d416

Browse files
committed
chore: prettier v2 changes
1 parent ae55dd9 commit 173d416

File tree

99 files changed

+357
-357
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

+357
-357
lines changed

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

+26-26
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test('should produce help for problems', async () => {
6969
const cwd = await gitBootstrap('fixtures/default');
7070
const actual = await cli([], {cwd})('foo: bar');
7171
expect(actual.stdout).toContain(
72-
'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
72+
'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
7373
);
7474
expect(actual.exitCode).toBe(1);
7575
});
@@ -78,10 +78,10 @@ test('should produce help for problems with correct helpurl', async () => {
7878
const cwd = await gitBootstrap('fixtures/default');
7979
const actual = await cli(
8080
['-H https://github.com/conventional-changelog/commitlint/#testhelpurl'],
81-
{cwd},
81+
{cwd}
8282
)('foo: bar');
8383
expect(actual.stdout).toContain(
84-
'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl',
84+
'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl'
8585
);
8686
expect(actual.exitCode).toBe(1);
8787
});
@@ -152,7 +152,7 @@ test('should work with husky commitmsg hook and git commit', async () => {
152152
const commit = await execa(
153153
'git',
154154
['commit', '-m', '"test: this should work"'],
155-
{cwd},
155+
{cwd}
156156
);
157157

158158
expect(commit).toBeTruthy();
@@ -168,7 +168,7 @@ test('should work with husky commitmsg hook in sub packages', async () => {
168168
const commit = await execa(
169169
'git',
170170
['commit', '-m', '"test: this should work"'],
171-
{cwd},
171+
{cwd}
172172
);
173173
expect(commit).toBeTruthy();
174174
});
@@ -177,15 +177,15 @@ test('should work with husky via commitlint -e $GIT_PARAMS', async () => {
177177
const cwd = await gitBootstrap('fixtures/husky/integration');
178178
await writePkg(
179179
{husky: {hooks: {'commit-msg': `'${bin}' -e $GIT_PARAMS`}}},
180-
{cwd},
180+
{cwd}
181181
);
182182

183183
// await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines
184184
await execa('git', ['add', 'package.json'], {cwd});
185185
const commit = await execa(
186186
'git',
187187
['commit', '-m', '"test: this should work"'],
188-
{cwd},
188+
{cwd}
189189
);
190190
expect(commit).toBeTruthy();
191191
});
@@ -194,15 +194,15 @@ test('should work with husky via commitlint -e %GIT_PARAMS%', async () => {
194194
const cwd = await gitBootstrap('fixtures/husky/integration');
195195
await writePkg(
196196
{husky: {hooks: {'commit-msg': `'${bin}' -e %GIT_PARAMS%`}}},
197-
{cwd},
197+
{cwd}
198198
);
199199

200200
// await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines
201201
await execa('git', ['add', 'package.json'], {cwd});
202202
const commit = await execa(
203203
'git',
204204
['commit', '-m', '"test: this should work"'],
205-
{cwd},
205+
{cwd}
206206
);
207207
expect(commit).toBeTruthy();
208208
});
@@ -211,15 +211,15 @@ test('should work with husky via commitlint -e $HUSKY_GIT_PARAMS', async () => {
211211
const cwd = await gitBootstrap('fixtures/husky/integration');
212212
await writePkg(
213213
{husky: {hooks: {'commit-msg': `'${bin}' -e $HUSKY_GIT_PARAMS`}}},
214-
{cwd},
214+
{cwd}
215215
);
216216

217217
// await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines
218218
await execa('git', ['add', 'package.json'], {cwd});
219219
const commit = await execa(
220220
'git',
221221
['commit', '-m', '"test: this should work"'],
222-
{cwd},
222+
{cwd}
223223
);
224224
expect(commit).toBeTruthy();
225225
});
@@ -228,15 +228,15 @@ test('should work with husky via commitlint -e %HUSKY_GIT_PARAMS%', async () =>
228228
const cwd = await gitBootstrap('fixtures/husky/integration');
229229
await writePkg(
230230
{husky: {hooks: {'commit-msg': `'${bin}' -e %HUSKY_GIT_PARAMS%`}}},
231-
{cwd},
231+
{cwd}
232232
);
233233

234234
// await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines
235235
await execa('git', ['add', 'package.json'], {cwd});
236236
const commit = await execa(
237237
'git',
238238
['commit', '-m', '"test: this should work"'],
239-
{cwd},
239+
{cwd}
240240
);
241241
expect(commit).toBeTruthy();
242242
});
@@ -255,7 +255,7 @@ test('should allow reading of environment variables for edit file, failing if in
255255
const cwd = await gitBootstrap('fixtures/simple');
256256
await fs.writeFile(
257257
path.join(cwd, 'commit-msg-file'),
258-
'foo: bar\n\nFoo bar bizz buzz.\n\nCloses #123.',
258+
'foo: bar\n\nFoo bar bizz buzz.\n\nCloses #123.'
259259
);
260260
const actual = await cli(['--env', 'variable'], {
261261
cwd,
@@ -267,7 +267,7 @@ test('should allow reading of environment variables for edit file, failing if in
267267
test('should pick up parser preset and fail accordingly', async () => {
268268
const cwd = await gitBootstrap('fixtures/parser-preset');
269269
const actual = await cli(['--parser-preset', './parser-preset'], {cwd})(
270-
'type(scope): subject',
270+
'type(scope): subject'
271271
);
272272
expect(actual.exitCode).toBe(1);
273273
expect(actual.stdout).toContain('may not be empty');
@@ -276,7 +276,7 @@ test('should pick up parser preset and fail accordingly', async () => {
276276
test('should pick up parser preset and succeed accordingly', async () => {
277277
const cwd = await gitBootstrap('fixtures/parser-preset');
278278
const actual = await cli(['--parser-preset', './parser-preset'], {cwd})(
279-
'----type(scope): subject',
279+
'----type(scope): subject'
280280
);
281281
expect(actual.exitCode).toBe(0);
282282
});
@@ -322,7 +322,7 @@ test('should handle --amend with signoff', async () => {
322322
await execa(
323323
'git',
324324
['commit', '-m', '"test: this should work"', '--signoff'],
325-
{cwd},
325+
{cwd}
326326
);
327327
const commit = await execa('git', ['commit', '--amend', '--no-edit'], {cwd});
328328

@@ -342,7 +342,7 @@ test("it doesn't use parserOpts.commentChar when using edit mode", async () => {
342342
const cwd = await gitBootstrap('fixtures/comment-char');
343343
await fs.writeFile(
344344
path.join(cwd, '.git', 'COMMIT_EDITMSG'),
345-
'header: foo\n\n$body\n',
345+
'header: foo\n\n$body\n'
346346
);
347347

348348
const actual = await cli(['--edit', '.git/COMMIT_EDITMSG'], {cwd})();
@@ -355,7 +355,7 @@ test('it uses core.commentChar git config when using edit mode', async () => {
355355
await execa('git', ['config', '--local', 'core.commentChar', '$'], {cwd});
356356
await fs.writeFile(
357357
path.join(cwd, '.git', 'COMMIT_EDITMSG'),
358-
'header: foo\n\n$body\n',
358+
'header: foo\n\n$body\n'
359359
);
360360

361361
const actual = await cli(['--edit', '.git/COMMIT_EDITMSG'], {cwd})();
@@ -367,7 +367,7 @@ test('it falls back to # for core.commentChar when using edit mode', async () =>
367367
const cwd = await gitBootstrap('fixtures/comment-char');
368368
await fs.writeFile(
369369
path.join(cwd, '.git', 'COMMIT_EDITMSG'),
370-
'header: foo\n\n#body\n',
370+
'header: foo\n\n#body\n'
371371
);
372372

373373
const actual = await cli(['--edit', '.git/COMMIT_EDITMSG'], {cwd})();
@@ -408,7 +408,7 @@ test('should fail for invalid formatters from configuration', async () => {
408408
const actual = await cli([], {cwd})('foo: bar');
409409

410410
expect(actual.stderr).toContain(
411-
'Using format custom-formatter, but cannot find the module',
411+
'Using format custom-formatter, but cannot find the module'
412412
);
413413
expect(actual.stdout).toEqual('');
414414
expect(actual.exitCode).toBe(1);
@@ -449,7 +449,7 @@ test('should fail for invalid formatters from flags', async () => {
449449
const actual = await cli(['--format', 'through-flag'], {cwd})('foo: bar');
450450

451451
expect(actual.stderr).toContain(
452-
'Using format through-flag, but cannot find the module',
452+
'Using format through-flag, but cannot find the module'
453453
);
454454
expect(actual.stdout).toEqual('');
455455
expect(actual.exitCode).toBe(1);
@@ -458,11 +458,11 @@ test('should fail for invalid formatters from flags', async () => {
458458
test('should work with absolute formatter path', async () => {
459459
const formatterPath = path.resolve(
460460
__dirname,
461-
'../fixtures/custom-formatter/formatters/custom.js',
461+
'../fixtures/custom-formatter/formatters/custom.js'
462462
);
463463
const cwd = await gitBootstrap('fixtures/custom-formatter');
464464
const actual = await cli(['--format', formatterPath], {cwd})(
465-
'test: this should work',
465+
'test: this should work'
466466
);
467467

468468
expect(actual.stdout).toContain('custom-formatter-ok');
@@ -472,10 +472,10 @@ test('should work with absolute formatter path', async () => {
472472
test('should work with relative formatter path', async () => {
473473
const cwd = path.resolve(
474474
await gitBootstrap('fixtures/custom-formatter'),
475-
'./formatters',
475+
'./formatters'
476476
);
477477
const actual = await cli(['--format', './custom.js'], {cwd})(
478-
'test: this should work',
478+
'test: this should work'
479479
);
480480

481481
expect(actual.stdout).toContain('custom-formatter-ok');

@commitlint/cli/src/cli.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ const cli = yargs
120120
.version(
121121
'version',
122122
'display version information',
123-
`${pkg.name}@${pkg.version}`,
123+
`${pkg.name}@${pkg.version}`
124124
)
125125
.alias('v', 'version')
126126
.help('help')
127127
.alias('h', 'help')
128128
.usage(`${pkg.name}@${pkg.version} - ${pkg.description}\n`)
129129
.usage(
130-
`[input] reads from stdin if --edit, --env, --from and --to are omitted`,
130+
`[input] reads from stdin if --edit, --env, --from and --to are omitted`
131131
)
132132
.strict();
133133

@@ -204,7 +204,7 @@ async function main(args: MainArgs): Promise<void> {
204204
if (messages.length === 0 && !checkFromRepository(flags)) {
205205
const err = new CliError(
206206
'[input] is required: supply via stdin, or --env or --edit or --from and --to',
207-
pkg.name,
207+
pkg.name
208208
);
209209
yargs.showHelp('log');
210210
console.log(err.message);
@@ -249,15 +249,15 @@ async function main(args: MainArgs): Promise<void> {
249249
if (!execaError.failed || execaError.exitCode !== 1) {
250250
console.warn(
251251
'Could not determine core.commentChar git configuration',
252-
e,
252+
e
253253
);
254254
}
255255
opts.parserOpts.commentChar = gitDefaultCommentChar;
256256
}
257257
}
258258

259259
const results = await Promise.all(
260-
messages.map((message) => lint(message, loaded.rules, opts)),
260+
messages.map((message) => lint(message, loaded.rules, opts))
261261
);
262262

263263
if (Object.keys(loaded.rules).length === 0) {
@@ -305,7 +305,7 @@ async function main(args: MainArgs): Promise<void> {
305305
errorCount: 0,
306306
warningCount: 0,
307307
results: [],
308-
},
308+
}
309309
);
310310

311311
const helpUrl = flags['help-url']?.trim() || loaded.helpUrl;
@@ -361,7 +361,7 @@ function getEditValue(flags: CliFlags) {
361361
if (flags.env) {
362362
if (!(flags.env in process.env)) {
363363
throw new Error(
364-
`Received '${flags.env}' as value for -E | --env, but environment variable '${flags.env}' is not available globally`,
364+
`Received '${flags.env}' as value for -E | --env, but environment variable '${flags.env}' is not available globally`
365365
);
366366
}
367367
return process.env[flags.env];
@@ -395,15 +395,15 @@ function getEditValue(flags: CliFlags) {
395395
return process.env.HUSKY_GIT_PARAMS;
396396
}
397397
throw new Error(
398-
`Received ${edit} as value for -e | --edit, but GIT_PARAMS or HUSKY_GIT_PARAMS are not available globally.`,
398+
`Received ${edit} as value for -e | --edit, but GIT_PARAMS or HUSKY_GIT_PARAMS are not available globally.`
399399
);
400400
}
401401
return edit;
402402
}
403403

404404
function getSeed(flags: CliFlags): UserConfig {
405405
const n = (flags.extends || []).filter(
406-
(i): i is string => typeof i === 'string',
406+
(i): i is string => typeof i === 'string'
407407
);
408408
return n.length > 0
409409
? {extends: n, parserPreset: flags['parser-preset']}

@commitlint/config-validator/src/formatErrors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export function formatErrors(errors: ErrorObject[]): string {
3232
: error.instancePath) || 'Config';
3333
if (error.keyword === 'typeof') {
3434
return `"${field}" should be a ${error.schema}. Value: ${JSON.stringify(
35-
error.data,
35+
error.data
3636
)}`;
3737
}
3838

3939
return `"${field}" ${error.message}. Value: ${JSON.stringify(
40-
error.data,
40+
error.data
4141
)}`;
4242
})
4343
.map((message) => `\t- ${message}.\n`)

@commitlint/config-validator/src/validate.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('validation should pass for', () => {
6161
describe('validation should fail for', () => {
6262
test.each(Object.entries(invalidSchemas))('%s', (file, config) => {
6363
expect(() =>
64-
validateConfig(`${file}.js`, config),
64+
validateConfig(`${file}.js`, config)
6565
).toThrowErrorMatchingSnapshot();
6666
});
6767
});

@commitlint/config-validator/src/validate.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const TYPE_OF = [
1515

1616
export function validateConfig(
1717
source: string,
18-
config: unknown,
18+
config: unknown
1919
): asserts config is UserConfig {
2020
const ajv = new Ajv({
2121
meta: false,
@@ -40,8 +40,8 @@ export function validateConfig(
4040
if (!isValid && validate.errors && validate.errors.length) {
4141
throw new Error(
4242
`Commitlint configuration in ${source} is invalid:\n${formatErrors(
43-
validate.errors,
44-
)}`,
43+
validate.errors
44+
)}`
4545
);
4646
}
4747
}

@commitlint/cz-commitlint/src/Process.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ describe('conventional-changlog', () => {
215215
return process(rules as any, prompts, InquirerFactory(answers) as any).then(
216216
(commitMessage) => {
217217
expect(commitMessage).toBe(
218-
'refactor(prompt): refactor prompt based on inquirer\n\ninspired by commitizen/cz-conventional-changelog\n\nBREAKING CHANGE: refactor types\nhttps://github.com/conventional-changelog/commitlint/issues/94',
218+
'refactor(prompt): refactor prompt based on inquirer\n\ninspired by commitizen/cz-conventional-changelog\n\nBREAKING CHANGE: refactor types\nhttps://github.com/conventional-changelog/commitlint/issues/94'
219219
);
220-
},
220+
}
221221
);
222222
});
223223

@@ -234,10 +234,10 @@ describe('conventional-changlog', () => {
234234
return process(rules as any, prompts, InquirerFactory(answers) as any).then(
235235
() => {
236236
expect(mockShowValidation).toHaveBeenCalledWith(
237-
'subject can not be empty',
237+
'subject can not be empty'
238238
);
239239
expect(mockShowTitle).toHaveBeenCalledTimes(3);
240-
},
240+
}
241241
);
242242
});
243243
});

@commitlint/cz-commitlint/src/Process.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {setRules} from './store/rules';
1818
export default async function (
1919
rules: QualifiedRules,
2020
prompts: UserPromptConfig,
21-
inquirer: Inquirer,
21+
inquirer: Inquirer
2222
): Promise<string> {
2323
setRules(rules);
2424
setPromptConfig(prompts);

0 commit comments

Comments
 (0)