diff --git a/@commitlint/cli/src/cli.test.ts b/@commitlint/cli/src/cli.test.ts index 129e25c49d..55acc263a9 100644 --- a/@commitlint/cli/src/cli.test.ts +++ b/@commitlint/cli/src/cli.test.ts @@ -69,7 +69,7 @@ test('should produce help for problems', async () => { const cwd = await gitBootstrap('fixtures/default'); const actual = await cli([], {cwd})('foo: bar'); expect(actual.stdout).toContain( - 'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint', + 'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint' ); expect(actual.exitCode).toBe(1); }); @@ -78,10 +78,10 @@ test('should produce help for problems with correct helpurl', async () => { const cwd = await gitBootstrap('fixtures/default'); const actual = await cli( ['-H https://github.com/conventional-changelog/commitlint/#testhelpurl'], - {cwd}, + {cwd} )('foo: bar'); expect(actual.stdout).toContain( - 'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl', + 'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl' ); expect(actual.exitCode).toBe(1); }); @@ -152,7 +152,7 @@ test('should work with husky commitmsg hook and git commit', async () => { const commit = await execa( 'git', ['commit', '-m', '"test: this should work"'], - {cwd}, + {cwd} ); expect(commit).toBeTruthy(); @@ -168,7 +168,7 @@ test('should work with husky commitmsg hook in sub packages', async () => { const commit = await execa( 'git', ['commit', '-m', '"test: this should work"'], - {cwd}, + {cwd} ); expect(commit).toBeTruthy(); }); @@ -177,7 +177,7 @@ test('should work with husky via commitlint -e $GIT_PARAMS', async () => { const cwd = await gitBootstrap('fixtures/husky/integration'); await writePkg( {husky: {hooks: {'commit-msg': `'${bin}' -e $GIT_PARAMS`}}}, - {cwd}, + {cwd} ); // await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines @@ -185,7 +185,7 @@ test('should work with husky via commitlint -e $GIT_PARAMS', async () => { const commit = await execa( 'git', ['commit', '-m', '"test: this should work"'], - {cwd}, + {cwd} ); expect(commit).toBeTruthy(); }); @@ -194,7 +194,7 @@ test('should work with husky via commitlint -e %GIT_PARAMS%', async () => { const cwd = await gitBootstrap('fixtures/husky/integration'); await writePkg( {husky: {hooks: {'commit-msg': `'${bin}' -e %GIT_PARAMS%`}}}, - {cwd}, + {cwd} ); // await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines @@ -202,7 +202,7 @@ test('should work with husky via commitlint -e %GIT_PARAMS%', async () => { const commit = await execa( 'git', ['commit', '-m', '"test: this should work"'], - {cwd}, + {cwd} ); expect(commit).toBeTruthy(); }); @@ -211,7 +211,7 @@ test('should work with husky via commitlint -e $HUSKY_GIT_PARAMS', async () => { const cwd = await gitBootstrap('fixtures/husky/integration'); await writePkg( {husky: {hooks: {'commit-msg': `'${bin}' -e $HUSKY_GIT_PARAMS`}}}, - {cwd}, + {cwd} ); // await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines @@ -219,7 +219,7 @@ test('should work with husky via commitlint -e $HUSKY_GIT_PARAMS', async () => { const commit = await execa( 'git', ['commit', '-m', '"test: this should work"'], - {cwd}, + {cwd} ); expect(commit).toBeTruthy(); }); @@ -228,7 +228,7 @@ test('should work with husky via commitlint -e %HUSKY_GIT_PARAMS%', async () => const cwd = await gitBootstrap('fixtures/husky/integration'); await writePkg( {husky: {hooks: {'commit-msg': `'${bin}' -e %HUSKY_GIT_PARAMS%`}}}, - {cwd}, + {cwd} ); // await execa('npm', ['install'], {cwd}); // npm install is failing on windows machines @@ -236,7 +236,7 @@ test('should work with husky via commitlint -e %HUSKY_GIT_PARAMS%', async () => const commit = await execa( 'git', ['commit', '-m', '"test: this should work"'], - {cwd}, + {cwd} ); expect(commit).toBeTruthy(); }); @@ -255,7 +255,7 @@ test('should allow reading of environment variables for edit file, failing if in const cwd = await gitBootstrap('fixtures/simple'); await fs.writeFile( path.join(cwd, 'commit-msg-file'), - 'foo: bar\n\nFoo bar bizz buzz.\n\nCloses #123.', + 'foo: bar\n\nFoo bar bizz buzz.\n\nCloses #123.' ); const actual = await cli(['--env', 'variable'], { cwd, @@ -267,7 +267,7 @@ test('should allow reading of environment variables for edit file, failing if in test('should pick up parser preset and fail accordingly', async () => { const cwd = await gitBootstrap('fixtures/parser-preset'); const actual = await cli(['--parser-preset', './parser-preset'], {cwd})( - 'type(scope): subject', + 'type(scope): subject' ); expect(actual.exitCode).toBe(1); expect(actual.stdout).toContain('may not be empty'); @@ -276,7 +276,7 @@ test('should pick up parser preset and fail accordingly', async () => { test('should pick up parser preset and succeed accordingly', async () => { const cwd = await gitBootstrap('fixtures/parser-preset'); const actual = await cli(['--parser-preset', './parser-preset'], {cwd})( - '----type(scope): subject', + '----type(scope): subject' ); expect(actual.exitCode).toBe(0); }); @@ -322,7 +322,7 @@ test('should handle --amend with signoff', async () => { await execa( 'git', ['commit', '-m', '"test: this should work"', '--signoff'], - {cwd}, + {cwd} ); const commit = await execa('git', ['commit', '--amend', '--no-edit'], {cwd}); @@ -342,7 +342,7 @@ test("it doesn't use parserOpts.commentChar when using edit mode", async () => { const cwd = await gitBootstrap('fixtures/comment-char'); await fs.writeFile( path.join(cwd, '.git', 'COMMIT_EDITMSG'), - 'header: foo\n\n$body\n', + 'header: foo\n\n$body\n' ); 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 () => { await execa('git', ['config', '--local', 'core.commentChar', '$'], {cwd}); await fs.writeFile( path.join(cwd, '.git', 'COMMIT_EDITMSG'), - 'header: foo\n\n$body\n', + 'header: foo\n\n$body\n' ); 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 () => const cwd = await gitBootstrap('fixtures/comment-char'); await fs.writeFile( path.join(cwd, '.git', 'COMMIT_EDITMSG'), - 'header: foo\n\n#body\n', + 'header: foo\n\n#body\n' ); const actual = await cli(['--edit', '.git/COMMIT_EDITMSG'], {cwd})(); @@ -408,7 +408,7 @@ test('should fail for invalid formatters from configuration', async () => { const actual = await cli([], {cwd})('foo: bar'); expect(actual.stderr).toContain( - 'Using format custom-formatter, but cannot find the module', + 'Using format custom-formatter, but cannot find the module' ); expect(actual.stdout).toEqual(''); expect(actual.exitCode).toBe(1); @@ -449,7 +449,7 @@ test('should fail for invalid formatters from flags', async () => { const actual = await cli(['--format', 'through-flag'], {cwd})('foo: bar'); expect(actual.stderr).toContain( - 'Using format through-flag, but cannot find the module', + 'Using format through-flag, but cannot find the module' ); expect(actual.stdout).toEqual(''); expect(actual.exitCode).toBe(1); @@ -458,11 +458,11 @@ test('should fail for invalid formatters from flags', async () => { test('should work with absolute formatter path', async () => { const formatterPath = path.resolve( __dirname, - '../fixtures/custom-formatter/formatters/custom.js', + '../fixtures/custom-formatter/formatters/custom.js' ); const cwd = await gitBootstrap('fixtures/custom-formatter'); const actual = await cli(['--format', formatterPath], {cwd})( - 'test: this should work', + 'test: this should work' ); expect(actual.stdout).toContain('custom-formatter-ok'); @@ -472,10 +472,10 @@ test('should work with absolute formatter path', async () => { test('should work with relative formatter path', async () => { const cwd = path.resolve( await gitBootstrap('fixtures/custom-formatter'), - './formatters', + './formatters' ); const actual = await cli(['--format', './custom.js'], {cwd})( - 'test: this should work', + 'test: this should work' ); expect(actual.stdout).toContain('custom-formatter-ok'); diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index 2bcb2da73e..f4e1c025ae 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -120,14 +120,14 @@ const cli = yargs .version( 'version', 'display version information', - `${pkg.name}@${pkg.version}`, + `${pkg.name}@${pkg.version}` ) .alias('v', 'version') .help('help') .alias('h', 'help') .usage(`${pkg.name}@${pkg.version} - ${pkg.description}\n`) .usage( - `[input] reads from stdin if --edit, --env, --from and --to are omitted`, + `[input] reads from stdin if --edit, --env, --from and --to are omitted` ) .strict(); @@ -204,7 +204,7 @@ async function main(args: MainArgs): Promise { if (messages.length === 0 && !checkFromRepository(flags)) { const err = new CliError( '[input] is required: supply via stdin, or --env or --edit or --from and --to', - pkg.name, + pkg.name ); yargs.showHelp('log'); console.log(err.message); @@ -249,7 +249,7 @@ async function main(args: MainArgs): Promise { if (!execaError.failed || execaError.exitCode !== 1) { console.warn( 'Could not determine core.commentChar git configuration', - e, + e ); } opts.parserOpts.commentChar = gitDefaultCommentChar; @@ -257,7 +257,7 @@ async function main(args: MainArgs): Promise { } const results = await Promise.all( - messages.map((message) => lint(message, loaded.rules, opts)), + messages.map((message) => lint(message, loaded.rules, opts)) ); if (Object.keys(loaded.rules).length === 0) { @@ -305,7 +305,7 @@ async function main(args: MainArgs): Promise { errorCount: 0, warningCount: 0, results: [], - }, + } ); const helpUrl = flags['help-url']?.trim() || loaded.helpUrl; @@ -361,7 +361,7 @@ function getEditValue(flags: CliFlags) { if (flags.env) { if (!(flags.env in process.env)) { throw new Error( - `Received '${flags.env}' as value for -E | --env, but environment variable '${flags.env}' is not available globally`, + `Received '${flags.env}' as value for -E | --env, but environment variable '${flags.env}' is not available globally` ); } return process.env[flags.env]; @@ -395,7 +395,7 @@ function getEditValue(flags: CliFlags) { return process.env.HUSKY_GIT_PARAMS; } throw new Error( - `Received ${edit} as value for -e | --edit, but GIT_PARAMS or HUSKY_GIT_PARAMS are not available globally.`, + `Received ${edit} as value for -e | --edit, but GIT_PARAMS or HUSKY_GIT_PARAMS are not available globally.` ); } return edit; @@ -403,7 +403,7 @@ function getEditValue(flags: CliFlags) { function getSeed(flags: CliFlags): UserConfig { const n = (flags.extends || []).filter( - (i): i is string => typeof i === 'string', + (i): i is string => typeof i === 'string' ); return n.length > 0 ? {extends: n, parserPreset: flags['parser-preset']} diff --git a/@commitlint/config-validator/src/formatErrors.ts b/@commitlint/config-validator/src/formatErrors.ts index d9086fd076..9c9943d11f 100644 --- a/@commitlint/config-validator/src/formatErrors.ts +++ b/@commitlint/config-validator/src/formatErrors.ts @@ -32,12 +32,12 @@ export function formatErrors(errors: ErrorObject[]): string { : error.instancePath) || 'Config'; if (error.keyword === 'typeof') { return `"${field}" should be a ${error.schema}. Value: ${JSON.stringify( - error.data, + error.data )}`; } return `"${field}" ${error.message}. Value: ${JSON.stringify( - error.data, + error.data )}`; }) .map((message) => `\t- ${message}.\n`) diff --git a/@commitlint/config-validator/src/validate.test.ts b/@commitlint/config-validator/src/validate.test.ts index bfe9fa7ede..93203951ae 100644 --- a/@commitlint/config-validator/src/validate.test.ts +++ b/@commitlint/config-validator/src/validate.test.ts @@ -61,7 +61,7 @@ describe('validation should pass for', () => { describe('validation should fail for', () => { test.each(Object.entries(invalidSchemas))('%s', (file, config) => { expect(() => - validateConfig(`${file}.js`, config), + validateConfig(`${file}.js`, config) ).toThrowErrorMatchingSnapshot(); }); }); diff --git a/@commitlint/config-validator/src/validate.ts b/@commitlint/config-validator/src/validate.ts index 714a845e96..256e2ffe2b 100644 --- a/@commitlint/config-validator/src/validate.ts +++ b/@commitlint/config-validator/src/validate.ts @@ -15,7 +15,7 @@ const TYPE_OF = [ export function validateConfig( source: string, - config: unknown, + config: unknown ): asserts config is UserConfig { const ajv = new Ajv({ meta: false, @@ -40,8 +40,8 @@ export function validateConfig( if (!isValid && validate.errors && validate.errors.length) { throw new Error( `Commitlint configuration in ${source} is invalid:\n${formatErrors( - validate.errors, - )}`, + validate.errors + )}` ); } } diff --git a/@commitlint/cz-commitlint/src/Process.test.ts b/@commitlint/cz-commitlint/src/Process.test.ts index 5d640468b9..323ea4f189 100644 --- a/@commitlint/cz-commitlint/src/Process.test.ts +++ b/@commitlint/cz-commitlint/src/Process.test.ts @@ -215,9 +215,9 @@ describe('conventional-changlog', () => { return process(rules as any, prompts, InquirerFactory(answers) as any).then( (commitMessage) => { expect(commitMessage).toBe( - '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', + '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' ); - }, + } ); }); @@ -234,10 +234,10 @@ describe('conventional-changlog', () => { return process(rules as any, prompts, InquirerFactory(answers) as any).then( () => { expect(mockShowValidation).toHaveBeenCalledWith( - 'subject can not be empty', + 'subject can not be empty' ); expect(mockShowTitle).toHaveBeenCalledTimes(3); - }, + } ); }); }); diff --git a/@commitlint/cz-commitlint/src/Process.ts b/@commitlint/cz-commitlint/src/Process.ts index 86b3455df8..f1ec42d36f 100644 --- a/@commitlint/cz-commitlint/src/Process.ts +++ b/@commitlint/cz-commitlint/src/Process.ts @@ -18,7 +18,7 @@ import {setRules} from './store/rules'; export default async function ( rules: QualifiedRules, prompts: UserPromptConfig, - inquirer: Inquirer, + inquirer: Inquirer ): Promise { setRules(rules); setPromptConfig(prompts); diff --git a/@commitlint/cz-commitlint/src/Question.test.ts b/@commitlint/cz-commitlint/src/Question.test.ts index 157e900897..18516eda48 100644 --- a/@commitlint/cz-commitlint/src/Question.test.ts +++ b/@commitlint/cz-commitlint/src/Question.test.ts @@ -26,7 +26,7 @@ describe('name', () => { () => new Question('' as any, { ...QUESTION_CONFIG, - }), + }) ).toThrow(); expect( @@ -37,8 +37,8 @@ describe('name', () => { } as any, { ...QUESTION_CONFIG, - }, - ), + } + ) ).toThrow(); }); @@ -46,7 +46,7 @@ describe('name', () => { expect( new Question('test' as any, { ...QUESTION_CONFIG, - }).question, + }).question ).toHaveProperty('name', 'test'); }); }); @@ -128,7 +128,7 @@ describe('message', () => { }).question; expect(question).toHaveProperty('message', expect.any(Function)); expect((question.message as any)()).toBe( - 'please input (press enter to skip):\n', + 'please input (press enter to skip):\n' ); }); @@ -158,7 +158,7 @@ describe('message', () => { } as any).question; expect(question).toHaveProperty('message', expect.any(Function)); expect((question.message as any)()).toBe( - 'please input: 10 chars at least\n', + 'please input: 10 chars at least\n' ); }); @@ -171,7 +171,7 @@ describe('message', () => { } as any).question; expect(question).toHaveProperty('message', expect.any(Function)); expect((question.message as any)()).toBe( - 'please input (press enter to skip): 10 chars at least, upper 80 chars\n', + 'please input (press enter to skip): 10 chars at least, upper 80 chars\n' ); }); @@ -306,7 +306,7 @@ describe('transformer', () => { }).question; expect( - (question as InputQuestionOptions)?.transformer?.('xxxx', {}, {}), + (question as InputQuestionOptions)?.transformer?.('xxxx', {}, {}) ).toBe('Xxxx!'); }); @@ -317,7 +317,7 @@ describe('transformer', () => { }).question; expect( - (question as InputQuestionOptions)?.transformer?.('xxx', {}, {}), + (question as InputQuestionOptions)?.transformer?.('xxx', {}, {}) ).toEqual(chalk.green(`(3) xxx`)); question = new Question('body', { @@ -326,7 +326,7 @@ describe('transformer', () => { }).question; expect( - (question as InputQuestionOptions)?.transformer?.('xxx', {}, {}), + (question as InputQuestionOptions)?.transformer?.('xxx', {}, {}) ).toEqual(chalk.green(`(3) xxx`)); }); @@ -337,7 +337,7 @@ describe('transformer', () => { }).question; expect( - (question as InputQuestionOptions)?.transformer?.('xxxxxx', {}, {}), + (question as InputQuestionOptions)?.transformer?.('xxxxxx', {}, {}) ).toEqual(chalk.red(`(6) xxxxxx`)); question = new Question('body', { @@ -346,7 +346,7 @@ describe('transformer', () => { }).question; expect( - (question as InputQuestionOptions)?.transformer?.('x', {}, {}), + (question as InputQuestionOptions)?.transformer?.('x', {}, {}) ).toEqual(chalk.red(`(1) x`)); }); }); diff --git a/@commitlint/cz-commitlint/src/Question.ts b/@commitlint/cz-commitlint/src/Question.ts index 136d5ffa1c..5ed72223a4 100644 --- a/@commitlint/cz-commitlint/src/Question.ts +++ b/@commitlint/cz-commitlint/src/Question.ts @@ -48,7 +48,7 @@ export default class Question { minLength, multipleValueDelimiters, multipleSelectDefaultDelimiter, - }: QuestionConfig, + }: QuestionConfig ) { if (!name || typeof name !== 'string') throw new Error('Question: name is required'); @@ -163,7 +163,7 @@ export default class Question { new RegExp(`[^${this.multipleValueDelimiters.source}]+`, 'g'), (segment) => { return casedSegments[segments.indexOf(segment)]; - }, + } ); } else { toCased = this.caseFn(input); @@ -192,12 +192,12 @@ export default class Question { const messages = []; if (this.minLength > 0 && this.getMessage('min')) { messages.push( - this.getMessage('min').replace(/%d/g, this.minLength + ''), + this.getMessage('min').replace(/%d/g, this.minLength + '') ); } if (this.maxLength < Infinity && this.getMessage('max')) { messages.push( - this.getMessage('max').replace(/%d/g, this.maxLength + ''), + this.getMessage('max').replace(/%d/g, this.maxLength + '') ); } diff --git a/@commitlint/cz-commitlint/src/SectionBody.ts b/@commitlint/cz-commitlint/src/SectionBody.ts index 92d9e7f4ed..d5f00a3e18 100644 --- a/@commitlint/cz-commitlint/src/SectionBody.ts +++ b/@commitlint/cz-commitlint/src/SectionBody.ts @@ -29,7 +29,7 @@ export function combineCommitMessage(answers: Answers): string { trim: true, indent: '', }) - : commitBody.trim(), + : commitBody.trim() ); } else { return ''; diff --git a/@commitlint/cz-commitlint/src/SectionFooter.test.ts b/@commitlint/cz-commitlint/src/SectionFooter.test.ts index 8846f870be..06752401d5 100644 --- a/@commitlint/cz-commitlint/src/SectionFooter.test.ts +++ b/@commitlint/cz-commitlint/src/SectionFooter.test.ts @@ -68,12 +68,12 @@ describe('getQuestions', () => { expect( (questions[1].when as any)({ isBreaking: false, - }), + }) ).toBe(false); expect( (questions[1].when as any)({ isBreaking: true, - }), + }) ).toBe(true); }); @@ -95,20 +95,20 @@ describe('getQuestions', () => { expect( (questions[1].when as any)({ isBreaking: true, - }), + }) ).toBe(true); expect( (questions[1].when as any)({ isBreaking: true, body: 'xxx', - }), + }) ).toBe(false); expect( (questions[1].when as any)({ isBreaking: false, - }), + }) ).toBe(false); }); @@ -146,12 +146,12 @@ describe('getQuestions', () => { expect( (questions[1].when as any)({ isIssueAffected: false, - }), + }) ).toBe(false); expect( (questions[1].when as any)({ isIssueAffected: true, - }), + }) ).toBe(true); }); @@ -176,21 +176,21 @@ describe('getQuestions', () => { expect( (questions[1].when as any)({ isIssueAffected: true, - }), + }) ).toBe(true); expect( (questions[1].when as any)({ isIssueAffected: true, body: 'xxx', - }), + }) ).toBe(false); expect( (questions[1].when as any)({ isIssueAffected: false, breaking: 'xxxxx', - }), + }) ).toBe(false); }); }); @@ -215,7 +215,7 @@ describe('combineCommitMessage', () => { footer: 'Other footer information.', }); expect(commitMessage).toBe( - 'BREAKING CHANGE: xxxxxx\nhttps://github.com/conventional-changelog/commitlint/issues/2507\nOther footer information.', + 'BREAKING CHANGE: xxxxxx\nhttps://github.com/conventional-changelog/commitlint/issues/2507\nOther footer information.' ); }); @@ -230,7 +230,7 @@ describe('combineCommitMessage', () => { footer: 'Other footer information.', }); expect(commitMessage).toBe( - 'BREAKING\nCHANGE:\nxxxxxx\nhttps://github.com/conventional-changelog/commitlint/issues/2507\nOther\nfooter\ninformation.', + 'BREAKING\nCHANGE:\nxxxxxx\nhttps://github.com/conventional-changelog/commitlint/issues/2507\nOther\nfooter\ninformation.' ); }); @@ -246,7 +246,7 @@ describe('combineCommitMessage', () => { footer: 'Other footer information.', }); expect(commitMessage).toBe( - '\nBREAKING\nCHANGE:\nxxxxxx\nhttps://github.com/conventional-changelog/commitlint/issues/2507\nOther\nfooter\ninformation.', + '\nBREAKING\nCHANGE:\nxxxxxx\nhttps://github.com/conventional-changelog/commitlint/issues/2507\nOther\nfooter\ninformation.' ); }); @@ -257,7 +257,7 @@ describe('combineCommitMessage', () => { footer: 'Other footer information.', }); expect(commitMessage).toBe( - 'https://github.com/conventional-changelog/commitlint/issues/2507\nOther footer information.', + 'https://github.com/conventional-changelog/commitlint/issues/2507\nOther footer information.' ); }); @@ -308,7 +308,7 @@ describe('FooterQuestion', () => { (lastQuestion.message as any)(answers); expect(lastQuestion?.validate?.(''.padEnd(10, 'z'), answers)).toBe( - 'footer: footer over limit 11', + 'footer: footer over limit 11' ); }); }); diff --git a/@commitlint/cz-commitlint/src/SectionFooter.ts b/@commitlint/cz-commitlint/src/SectionFooter.ts index 5548982e9f..de184cd07f 100644 --- a/@commitlint/cz-commitlint/src/SectionFooter.ts +++ b/@commitlint/cz-commitlint/src/SectionFooter.ts @@ -15,7 +15,7 @@ export class FooterQuestion extends Question { name: PromptName, questionConfig: QuestionConfig, footerMaxLength?: number, - footerMinLength?: number, + footerMinLength?: number ) { super(name, questionConfig); this.footerMaxLength = footerMaxLength ?? Infinity; @@ -115,7 +115,7 @@ export function getQuestions(): Array { name, questionConfigs, footerMaxLength, - footerMinLength, + footerMinLength ); return instance.question; @@ -142,7 +142,7 @@ export function combineCommitMessage(answers: Answers): string { trim: true, indent: '', }) - : message.trim(), + : message.trim() ); } @@ -154,7 +154,7 @@ export function combineCommitMessage(answers: Answers): string { trim: true, indent: '', }) - : issues.trim(), + : issues.trim() ); } @@ -166,7 +166,7 @@ export function combineCommitMessage(answers: Answers): string { trim: true, indent: '', }) - : footer, + : footer ); } diff --git a/@commitlint/cz-commitlint/src/SectionHeader.test.ts b/@commitlint/cz-commitlint/src/SectionHeader.test.ts index 6db148ab03..6b370b956a 100644 --- a/@commitlint/cz-commitlint/src/SectionHeader.test.ts +++ b/@commitlint/cz-commitlint/src/SectionHeader.test.ts @@ -51,7 +51,7 @@ describe('getQuestionConfig', () => { expect(config).toEqual( expect.objectContaining({ multipleValueDelimiters: /\/|\\|,/g, - }), + }) ); }); @@ -66,7 +66,7 @@ describe('getQuestionConfig', () => { expect(config).toEqual( expect.objectContaining({ multipleSelectDefaultDelimiter: '/', - }), + }) ); }); @@ -148,7 +148,7 @@ describe('HeaderQuestion', () => { const lastQuestion = questions[2]; (lastQuestion.message as any)(answers); expect(lastQuestion?.validate?.(''.padEnd(10, 'z'), answers)).toBe( - 'subject: subject over limit 6', + 'subject: subject over limit 6' ); }); }); diff --git a/@commitlint/cz-commitlint/src/SectionHeader.ts b/@commitlint/cz-commitlint/src/SectionHeader.ts index 507bd2b990..c3483cc79d 100644 --- a/@commitlint/cz-commitlint/src/SectionHeader.ts +++ b/@commitlint/cz-commitlint/src/SectionHeader.ts @@ -11,7 +11,7 @@ export class HeaderQuestion extends Question { name: PromptName, questionConfig: QuestionConfig, headerMaxLength?: number, - headerMinLength?: number, + headerMinLength?: number ) { super(name, questionConfig); this.headerMaxLength = headerMaxLength ?? Infinity; @@ -54,7 +54,7 @@ export function getQuestions(): Array { name, questionConfig, headerRuleQuestionConfig.maxLength, - headerRuleQuestionConfig.minLength, + headerRuleQuestionConfig.minLength ); questions.push(instance.question); } @@ -63,7 +63,7 @@ export function getQuestions(): Array { } export function getQuestionConfig( - name: RuleField, + name: RuleField ): ReturnType { const questionConfig = getRuleQuestionConfig(name); diff --git a/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts b/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts index e39da56024..6518b58483 100644 --- a/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts +++ b/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.test.ts @@ -204,21 +204,21 @@ describe('enum list', () => { expect(enumList).toEqual([ { name: expect.stringMatching( - new RegExp(`^cli:[\\s]{${LONGEST - 4 + 4}}Test CLI$`), + new RegExp(`^cli:[\\s]{${LONGEST - 4 + 4}}Test CLI$`) ), value: 'cli', short: 'cli', }, { name: expect.stringMatching( - new RegExp(`^core:[\\s]{${LONGEST - 5 + 4}}Test CORE$`), + new RegExp(`^core:[\\s]{${LONGEST - 5 + 4}}Test CORE$`) ), value: 'core', short: 'core', }, { name: expect.stringMatching( - new RegExp(`^${longestItem}:[\\s]{${-1 + 4}}Test$`), + new RegExp(`^${longestItem}:[\\s]{${-1 + 4}}Test$`) ), value: longestItem, short: longestItem, diff --git a/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts b/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts index f906eced15..8edbef8b16 100644 --- a/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts +++ b/@commitlint/cz-commitlint/src/services/getRuleQuestionConfig.ts @@ -39,7 +39,7 @@ export default function (rulePrefix: RuleField): QuestionConfig | null { if (enumDescriptions) { const enumNames = Object.keys(enumDescriptions); const longest = Math.max( - ...enumRuleList.map((enumName) => enumName.length), + ...enumRuleList.map((enumName) => enumName.length) ); // TODO emoji + title enumList = enumRuleList diff --git a/@commitlint/cz-commitlint/src/store/prompts.test.ts b/@commitlint/cz-commitlint/src/store/prompts.test.ts index 8adcdec4a5..e02741c9f9 100644 --- a/@commitlint/cz-commitlint/src/store/prompts.test.ts +++ b/@commitlint/cz-commitlint/src/store/prompts.test.ts @@ -53,10 +53,10 @@ describe('setPromptConfig', () => { setPromptConfig(promptConfig); expect(getPromptMessages()['emptyWarning']).toBe( - promptConfig.messages.emptyWarning, + promptConfig.messages.emptyWarning ); expect(getPromptMessages()['lowerLimitWarning']).toBe( - initialMessages['lowerLimitWarning'], + initialMessages['lowerLimitWarning'] ); }); @@ -73,7 +73,7 @@ describe('setPromptConfig', () => { setPromptConfig(promptConfig as any); expect(getPromptMessages()['emptyWarning']).toBe( - promptConfig.messages.emptyWarning, + promptConfig.messages.emptyWarning ); expect(getPromptMessages()['min']).toBe(initialMessages['min']); }); diff --git a/@commitlint/cz-commitlint/src/store/prompts.ts b/@commitlint/cz-commitlint/src/store/prompts.ts index 14d59a955b..2a5dd84485 100644 --- a/@commitlint/cz-commitlint/src/store/prompts.ts +++ b/@commitlint/cz-commitlint/src/store/prompts.ts @@ -32,7 +32,7 @@ export function setPromptConfig(newPromptConfig: UserPromptConfig): void { !/^\/|\\|,$/.test(settings['scopeEnumSeparator']) ) { console.log( - `prompt.settings.scopeEnumSeparator must be one of ',', '\\', '/'.`, + `prompt.settings.scopeEnumSeparator must be one of ',', '\\', '/'.` ); process.exit(1); } diff --git a/@commitlint/cz-commitlint/src/store/rules.test.ts b/@commitlint/cz-commitlint/src/store/rules.test.ts index c8c42ef2e3..1d12a9e851 100644 --- a/@commitlint/cz-commitlint/src/store/rules.test.ts +++ b/@commitlint/cz-commitlint/src/store/rules.test.ts @@ -19,7 +19,7 @@ describe('getRule', () => { expect(getRule('body', 'max-length')).toBe(rules['body-max-length']); expect(getRule('footer', 'max-line-length')).toBe( - rules['footer-max-line-length'], + rules['footer-max-line-length'] ); expect(getRule('subject', 'empty')).toBe(rules['subject-empty']); }); diff --git a/@commitlint/cz-commitlint/src/utils/leading-blank-fn.ts b/@commitlint/cz-commitlint/src/utils/leading-blank-fn.ts index 5f52a4aa62..e12c571276 100644 --- a/@commitlint/cz-commitlint/src/utils/leading-blank-fn.ts +++ b/@commitlint/cz-commitlint/src/utils/leading-blank-fn.ts @@ -7,7 +7,7 @@ import {ruleIsActive, ruleIsNotApplicable} from './rules'; * @return transform function applying the leading */ export default function getLeadingBlankFn( - rule?: Rule, + rule?: Rule ): (input: string) => string { if (!rule || !ruleIsActive(rule)) { return (input: string): string => input; diff --git a/@commitlint/cz-commitlint/src/utils/rules.test.ts b/@commitlint/cz-commitlint/src/utils/rules.test.ts index 27999e9c5b..880551a531 100644 --- a/@commitlint/cz-commitlint/src/utils/rules.test.ts +++ b/@commitlint/cz-commitlint/src/utils/rules.test.ts @@ -16,7 +16,7 @@ test('ruleIsDisabled', () => { expect(ruleIsDisabled([RuleConfigSeverity.Disabled, 'always'])).toBe(true); expect(ruleIsDisabled([RuleConfigSeverity.Error] as any)).toBe(false); expect(ruleIsDisabled([RuleConfigSeverity.Error, 'always'] as any)).toBe( - false, + false ); }); @@ -41,14 +41,14 @@ test('ruleIsNotApplicable', () => { expect(ruleIsNotApplicable([RuleConfigSeverity.Error, 'never'])).toBe(true); expect(ruleIsNotApplicable([RuleConfigSeverity.Warning, 'never'])).toBe(true); expect(ruleIsNotApplicable([RuleConfigSeverity.Disabled, 'never'])).toBe( - true, + true ); expect(ruleIsNotApplicable(undefined as any)).toBe(false); expect(ruleIsNotApplicable('' as any)).toBe(false); expect(ruleIsNotApplicable([RuleConfigSeverity.Error] as any)).toBe(false); expect(ruleIsNotApplicable([RuleConfigSeverity.Error, 'always'])).toBe(false); expect(ruleIsNotApplicable([RuleConfigSeverity.Error, 'always', 100])).toBe( - false, + false ); }); diff --git a/@commitlint/cz-commitlint/src/utils/rules.ts b/@commitlint/cz-commitlint/src/utils/rules.ts index d2c2e6fe4c..b9758e2184 100644 --- a/@commitlint/cz-commitlint/src/utils/rules.ts +++ b/@commitlint/cz-commitlint/src/utils/rules.ts @@ -2,7 +2,7 @@ import {RuleConfigSeverity} from '@commitlint/types'; import {Rule} from '../types'; export function ruleIsDisabled( - rule: Rule, + rule: Rule ): rule is Readonly<[RuleConfigSeverity.Disabled]> { if (rule && Array.isArray(rule) && rule[0] === RuleConfigSeverity.Disabled) { return true; @@ -16,7 +16,7 @@ export function ruleIsDisabled( * @return if the rule definition is active */ export function ruleIsActive( - rule: T, + rule: T ): rule is Exclude> { if (rule && Array.isArray(rule)) { return rule[0] > RuleConfigSeverity.Disabled; @@ -30,7 +30,7 @@ export function ruleIsActive( * @return if the rule definition is applicable */ export function ruleIsApplicable( - rule: Rule, + rule: Rule ): rule is | Readonly<[RuleConfigSeverity, 'always']> | Readonly<[RuleConfigSeverity, 'always', unknown]> { @@ -46,7 +46,7 @@ export function ruleIsApplicable( * @return if the rule definition is applicable */ export function ruleIsNotApplicable( - rule: Rule, + rule: Rule ): rule is | Readonly<[RuleConfigSeverity, 'never']> | Readonly<[RuleConfigSeverity, 'never', unknown]> { @@ -57,7 +57,7 @@ export function ruleIsNotApplicable( } export function enumRuleIsActive( - rule: Rule, + rule: Rule ): rule is Readonly< [RuleConfigSeverity.Warning | RuleConfigSeverity.Error, 'always', string[]] > { diff --git a/@commitlint/ensure/src/case.test.ts b/@commitlint/ensure/src/case.test.ts index 5a800da60e..532916dcec 100644 --- a/@commitlint/ensure/src/case.test.ts +++ b/@commitlint/ensure/src/case.test.ts @@ -163,7 +163,7 @@ test('true for `Any_CASE_iN_back-quotes` on start-case', () => { test('true for lowercase `Any_CASE_iN_back-quotes` lowercase on lowercase', () => { const actual = ensure( 'lowercase `Any_CASE_iN_back-quotes` lowercase', - 'lowercase', + 'lowercase' ); expect(actual).toBe(true); }); @@ -171,7 +171,7 @@ test('true for lowercase `Any_CASE_iN_back-quotes` lowercase on lowercase', () = test('false for UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE on lowercase', () => { const actual = ensure( 'UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE', - 'lowercase', + 'lowercase' ); expect(actual).toBe(false); }); @@ -179,7 +179,7 @@ test('false for UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE on lowercase', () test('true for UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE on uppercase', () => { const actual = ensure( 'UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE', - 'uppercase', + 'uppercase' ); expect(actual).toBe(true); }); @@ -187,7 +187,7 @@ test('true for UPPERCASE `Any_CASE_iN_back-quotes` UPPERCASE on uppercase', () = test('false for lowercase `Any_CASE_iN_back-quotes` lowercase on uppercase', () => { const actual = ensure( 'lowercase `Any_CASE_iN_back-quotes` lowercase', - 'uppercase', + 'uppercase' ); expect(actual).toBe(false); }); @@ -200,7 +200,7 @@ test('true for fooBar`Any_CASE_iN_back-quotes`fooBar on camel-case', () => { test('false for Foo Bar`Any_CASE_iN_back-quotes` Foo Bar on camel-case', () => { const actual = ensure( 'Foo Bar`Any_CASE_iN_back-quotes` Foo Bar', - 'camel-case', + 'camel-case' ); expect(actual).toBe(false); }); @@ -208,7 +208,7 @@ test('false for Foo Bar`Any_CASE_iN_back-quotes` Foo Bar on camel-case', () => { test('true for foo-bar`Any_CASE_iN_back-quotes`foo-bar on kebab-case', () => { const actual = ensure( 'foo-bar`Any_CASE_iN_back-quotes`foo-bar', - 'kebab-case', + 'kebab-case' ); expect(actual).toBe(true); }); @@ -216,7 +216,7 @@ test('true for foo-bar`Any_CASE_iN_back-quotes`foo-bar on kebab-case', () => { test('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on kebab-case', () => { const actual = ensure( 'Foo Bar `Any_CASE_iN_back-quotes` Foo Bar', - 'kebab-case', + 'kebab-case' ); expect(actual).toBe(false); }); @@ -224,7 +224,7 @@ test('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on kebab-case', () => test('true for foo_bar`Any_CASE_iN_back-quotes`foo_bar on snake-case', () => { const actual = ensure( 'foo_bar`Any_CASE_iN_back-quotes`foo_bar', - 'snake-case', + 'snake-case' ); expect(actual).toBe(true); }); @@ -232,7 +232,7 @@ test('true for foo_bar`Any_CASE_iN_back-quotes`foo_bar on snake-case', () => { test('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on snake-case', () => { const actual = ensure( 'Foo Bar `Any_CASE_iN_back-quotes` Foo Bar', - 'snake-case', + 'snake-case' ); expect(actual).toBe(false); }); @@ -240,7 +240,7 @@ test('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on snake-case', () => test('true for PascalCase`Any_CASE_iN_back-quotes`PascalCase on pascal-case', () => { const actual = ensure( 'PascalCase`Any_CASE_iN_back-quotes`PascalCase', - 'pascal-case', + 'pascal-case' ); expect(actual).toBe(true); }); @@ -248,7 +248,7 @@ test('true for PascalCase`Any_CASE_iN_back-quotes`PascalCase on pascal-case', () test('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on pascal-case', () => { const actual = ensure( 'Foo Bar `Any_CASE_iN_back-quotes` Foo Bar', - 'pascal-case', + 'pascal-case' ); expect(actual).toBe(false); }); @@ -256,7 +256,7 @@ test('false for Foo Bar `Any_CASE_iN_back-quotes` Foo Bar on pascal-case', () => test('true for Foo Bar`Any_CASE_iN_back-quotes` Foo Bar on start-case', () => { const actual = ensure( 'Foo Bar `Any_CASE_iN_back-quotes`Foo Bar', - 'start-case', + 'start-case' ); expect(actual).toBe(true); }); @@ -264,7 +264,7 @@ test('true for Foo Bar`Any_CASE_iN_back-quotes` Foo Bar on start-case', () => { test('false for foo_bar`Any_CASE_iN_back-quotes`foo_bar on start-case', () => { const actual = ensure( 'foo_bar`Any_CASE_iN_back-quotes`foo_bar', - 'start-case', + 'start-case' ); expect(actual).toBe(false); }); @@ -272,7 +272,7 @@ test('false for foo_bar`Any_CASE_iN_back-quotes`foo_bar on start-case', () => { test('true for lowercase `Any_CASE_iN_back-quotes` `Any_CASE_iN_back-quotes` lowercase on lowercase', () => { const actual = ensure( 'lowercase `Any_CASE_iN_back-quotes` `Any_CASE_iN_back-quotes` lowercase', - 'lowercase', + 'lowercase' ); expect(actual).toBe(true); }); diff --git a/@commitlint/ensure/src/case.ts b/@commitlint/ensure/src/case.ts index 3e0ee9c5ea..fcd8b35827 100644 --- a/@commitlint/ensure/src/case.ts +++ b/@commitlint/ensure/src/case.ts @@ -5,7 +5,7 @@ export default ensureCase; function ensureCase( raw: string = '', - target: TargetCaseType = 'lowercase', + target: TargetCaseType = 'lowercase' ): boolean { // We delete any content together with quotes because he can contains proper names (example `refactor: `Eslint` configuration`). // We need trim string because content with quotes can be at the beginning or end of a line diff --git a/@commitlint/ensure/src/max-line-length.test.ts b/@commitlint/ensure/src/max-line-length.test.ts index d2feb18809..b852599660 100644 --- a/@commitlint/ensure/src/max-line-length.test.ts +++ b/@commitlint/ensure/src/max-line-length.test.ts @@ -30,7 +30,7 @@ test('false for ab/\nab/\nab 1', () => { `ab ab ab`, - 2, + 2 ); expect(actual).toBe(true); @@ -41,7 +41,7 @@ test('true for ab/\nab/\nab 2', () => { `ab ab ab`, - 2, + 2 ); expect(actual).toBe(true); diff --git a/@commitlint/execute-rule/src/index.ts b/@commitlint/execute-rule/src/index.ts index 98cfe479ee..47029f4b89 100644 --- a/@commitlint/execute-rule/src/index.ts +++ b/@commitlint/execute-rule/src/index.ts @@ -7,7 +7,7 @@ type ExecutedRule = readonly [string, T]; export default execute; export async function execute( - rule?: Rule, + rule?: Rule ): Promise | null> { if (!Array.isArray(rule)) { return null; diff --git a/@commitlint/format/src/format.test.ts b/@commitlint/format/src/format.test.ts index 007fd1acfa..eea046405e 100644 --- a/@commitlint/format/src/format.test.ts +++ b/@commitlint/format/src/format.test.ts @@ -27,7 +27,7 @@ test('returns empty summary if verbose', () => { }, { verbose: true, - }, + } ); expect(actual).toContain('0 problems, 0 warnings'); @@ -117,7 +117,7 @@ test('uses signs as configured', () => { }, ], }, - options, + options ); const actualWarning = format( @@ -134,7 +134,7 @@ test('uses signs as configured', () => { }, ], }, - options, + options ); expect(actualError).toContain('ERR'); @@ -196,11 +196,11 @@ test('format result prints help for errors', () => { }, { helpUrl: 'https://example.com', - }, + } ); expect(actual).toEqual( - expect.arrayContaining([expect.stringContaining('Get help:')]), + expect.arrayContaining([expect.stringContaining('Get help:')]) ); }); @@ -217,11 +217,11 @@ test('format result prints help for warnings', () => { }, { helpUrl: 'https://example.com', - }, + } ); expect(actual).toEqual( - expect.arrayContaining([expect.stringContaining('Get help:')]), + expect.arrayContaining([expect.stringContaining('Get help:')]) ); }); @@ -240,11 +240,11 @@ test('format result help cotains options.helpUrl', () => { }, { helpUrl, - }, + } ); expect(actual).toEqual( - expect.arrayContaining([expect.stringContaining(helpUrl)]), + expect.arrayContaining([expect.stringContaining(helpUrl)]) ); }); @@ -254,7 +254,7 @@ test('format result omits help for empty problems', () => { }); expect(actual).not.toEqual( - expect.arrayContaining([expect.stringContaining('Get help:')]), + expect.arrayContaining([expect.stringContaining('Get help:')]) ); }); @@ -271,10 +271,10 @@ test('format result should not contain `Get help` prefix if helpUrl is not provi }, { helpUrl: '', - }, + } ); expect(actual).not.toEqual( - expect.arrayContaining([expect.stringContaining('Get help:')]), + expect.arrayContaining([expect.stringContaining('Get help:')]) ); }); diff --git a/@commitlint/format/src/format.ts b/@commitlint/format/src/format.ts index b6ea687c1d..e3fa2dd266 100644 --- a/@commitlint/format/src/format.ts +++ b/@commitlint/format/src/format.ts @@ -12,7 +12,7 @@ const DEFAULT_COLORS = ['white', 'yellow', 'red'] as const; export function format( report: FormattableReport = {}, - options: FormatOptions = {}, + options: FormatOptions = {} ): string { const {results = []} = report; const fi = (result: FormattableResult & WithInput) => @@ -24,14 +24,14 @@ export function format( .map((result) => [...fi(result), ...fr(result)]) .reduce( (acc, item) => (Array.isArray(item) ? [...acc, ...item] : [...acc, item]), - [], + [] ) .join('\n'); } function formatInput( result: FormattableResult & WithInput, - options: FormatOptions = {}, + options: FormatOptions = {} ): string[] { const {color: enabled = true} = options; const {errors = [], warnings = [], input = ''} = result; @@ -54,7 +54,7 @@ function formatInput( export function formatResult( result: FormattableResult = {}, - options: FormatOptions = {}, + options: FormatOptions = {} ): string[] { const { signs = DEFAULT_SIGNS, diff --git a/@commitlint/is-ignored/src/defaults.ts b/@commitlint/is-ignored/src/defaults.ts index cbbb327621..31d419e52b 100644 --- a/@commitlint/is-ignored/src/defaults.ts +++ b/@commitlint/is-ignored/src/defaults.ts @@ -16,7 +16,7 @@ const test = (r: RegExp): ((c: string) => boolean) => r.test.bind(r); export const wildcards: Matcher[] = [ test( - /^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m, + /^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m ), test(/^(Merge tag (.*?))(?:\r?\n)*$/m), test(/^(R|r)evert (.*)/), diff --git a/@commitlint/is-ignored/src/is-ignored.test.ts b/@commitlint/is-ignored/src/is-ignored.test.ts index d4a359af49..833ab04c49 100644 --- a/@commitlint/is-ignored/src/is-ignored.test.ts +++ b/@commitlint/is-ignored/src/is-ignored.test.ts @@ -30,7 +30,7 @@ const AMENDED_VERSION_MESSAGES = VERSION_MESSAGES.reduce( ...AMENDMENTS.map((amendment) => `${message}\n\n${amendment}`), ]; }, - [], + [] ); test('should return false when called without arguments', () => { @@ -66,7 +66,7 @@ test('should return true for merged PRs', () => { test('should return true for branch merges with newline characters and more characters after it', () => { expect(isIgnored("Merge branch 'ctrom-YarnBuild'\n ")).toBe(true); expect(isIgnored("Merge branch 'ctrom-YarnBuild'\r\n # some comment")).toBe( - true, + true ); }); @@ -93,13 +93,13 @@ test('should return true for tag merges with newline characters and more charact test('should return true for revert commits', () => { expect( isIgnored( - `Revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`, - ), + `Revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.` + ) ).toBe(true); expect( isIgnored( - `revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`, - ), + `revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.` + ) ).toBe(true); }); @@ -109,16 +109,16 @@ test('should ignore npm semver commits', () => { test('should ignore npm semver commits with chore', () => { VERSION_MESSAGES.forEach((message) => - expect(isIgnored(`chore: ${message}`)).toBe(true), + expect(isIgnored(`chore: ${message}`)).toBe(true) ); VERSION_MESSAGES.forEach((message) => - expect(isIgnored(`chore(release): ${message}`)).toBe(true), + expect(isIgnored(`chore(release): ${message}`)).toBe(true) ); }); test('should ignore npm semver commits with footers', () => { AMENDED_VERSION_MESSAGES.forEach((message) => - expect(isIgnored(message)).toBe(true), + expect(isIgnored(message)).toBe(true) ); }); @@ -132,10 +132,10 @@ test('should return true squash commits', () => { test('should return true for bitbucket merge commits', () => { expect( - isIgnored('Merged in feature/facebook-friends-sync (pull request #8)'), + isIgnored('Merged in feature/facebook-friends-sync (pull request #8)') ).toBe(true); expect( - isIgnored('Merged develop into feature/component-form-select-card'), + isIgnored('Merged develop into feature/component-form-select-card') ).toBe(true); expect(isIgnored('Automatic merge')).toBe(true); }); @@ -161,7 +161,7 @@ test('should return false for ignored message if defaults is false', () => { expect( isIgnored('Auto-merged develop into master', { defaults: false, - }), + }) ).toBe(false); }); @@ -169,7 +169,7 @@ test('should return false for ignored message if custom ignores and defaults is expect( isIgnored('Auto-merged develop into master', { defaults: false, - }), + }) ).toBe(false); }); @@ -187,7 +187,7 @@ test('should return true for custom ignores as function', () => { expect( isIgnored(ignoredString, { ignores: [(c) => c === ignoredString], - }), + }) ).toBe(true); }); diff --git a/@commitlint/is-ignored/src/is-ignored.ts b/@commitlint/is-ignored/src/is-ignored.ts index 17b588e1d1..716b45b9d0 100644 --- a/@commitlint/is-ignored/src/is-ignored.ts +++ b/@commitlint/is-ignored/src/is-ignored.ts @@ -3,13 +3,13 @@ import {IsIgnoredOptions} from '@commitlint/types'; export default function isIgnored( commit: string = '', - opts: IsIgnoredOptions = {}, + opts: IsIgnoredOptions = {} ): boolean { const ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores; if (!Array.isArray(ignores)) { throw new Error( - `ignores must be of type array, received ${ignores} of type ${typeof ignores}`, + `ignores must be of type array, received ${ignores} of type ${typeof ignores}` ); } @@ -19,7 +19,7 @@ export default function isIgnored( throw new Error( `ignores must be array of type function, received items of type: ${invalids .map((i) => typeof i) - .join(', ')}`, + .join(', ')}` ); } diff --git a/@commitlint/lint/src/lint.test.ts b/@commitlint/lint/src/lint.test.ts index 90e6e230f1..ea94b0b9c4 100644 --- a/@commitlint/lint/src/lint.test.ts +++ b/@commitlint/lint/src/lint.test.ts @@ -48,7 +48,7 @@ test('negative on ignored message, disabled ignored messages and broken rule', a }, { defaultIgnores: false, - }, + } ); expect(actual.valid).toBe(false); }); @@ -62,7 +62,7 @@ test('positive on custom ignored message and broken rule', async () => { }, { ignores: [(c) => c === ignoredMessage], - }, + } ); expect(actual.valid).toBe(true); expect(actual.input).toBe(ignoredMessage); @@ -79,7 +79,7 @@ test('positive on stub message and opts', async () => { parserOpts: { headerPattern: /^(\w*)(?:\((.*)\))?-(.*)$/, }, - }, + } ); expect(actual.valid).toBe(true); }); @@ -134,7 +134,7 @@ test('throws for rule with out of range level', async () => { await expect(error).rejects.toThrow('rule type-enum must be between 0 and 2'); await expect(error).rejects.toThrow( - 'rule header-max-length must be between 0 and 2', + 'rule header-max-length must be between 0 and 2' ); }); @@ -156,7 +156,7 @@ test('throws for rule with out of range condition', async () => { await expect(error).rejects.toThrow('type-enum must be "always" or "never"'); await expect(error).rejects.toThrow( - 'header-max-length must be "always" or "never"', + 'header-max-length must be "always" or "never"' ); }); @@ -186,7 +186,7 @@ test('succeds for custom issue prefix', async () => { parserOpts: { issuePrefixes: ['REF-'], }, - }, + } ); expect(report.valid).toBe(true); @@ -202,7 +202,7 @@ test('fails for custom issue prefix', async () => { parserOpts: { issuePrefixes: ['REF-'], }, - }, + } ); expect(report.valid).toBe(false); @@ -222,7 +222,7 @@ test('fails for custom plugin rule', async () => { }, }, }, - }, + } ); expect(report.valid).toBe(false); @@ -242,7 +242,7 @@ test('passes for custom plugin rule', async () => { }, }, }, - }, + } ); expect(report.valid).toBe(true); @@ -281,7 +281,7 @@ test('returns original message with commit header, body and footer, parsing comm parserOpts: { commentChar: '#', }, - }, + } ); expect(report.input).toBe(expected); @@ -301,7 +301,7 @@ test('passes for async rule', async () => { }, }, }, - }, + } ); expect(report.valid).toBe(true); diff --git a/@commitlint/lint/src/lint.ts b/@commitlint/lint/src/lint.ts index 5dcd651e6d..4c4ffd3905 100644 --- a/@commitlint/lint/src/lint.ts +++ b/@commitlint/lint/src/lint.ts @@ -17,7 +17,7 @@ import { export default async function lint( message: string, rawRulesConfig?: QualifiedRules, - rawOpts?: LintOptions, + rawOpts?: LintOptions ): Promise { const opts = rawOpts ? rawOpts @@ -57,14 +57,14 @@ export default async function lint( } const allRules: Map> = new Map( - Object.entries(defaultRules), + Object.entries(defaultRules) ); if (opts.plugins) { Object.values(opts.plugins).forEach((plugin) => { if (plugin.rules) { Object.keys(plugin.rules).forEach((ruleKey) => - allRules.set(ruleKey, plugin.rules[ruleKey]), + allRules.set(ruleKey, plugin.rules[ruleKey]) ); } }); @@ -72,15 +72,15 @@ export default async function lint( // Find invalid rules configs const missing = Object.keys(rulesConfig).filter( - (name) => typeof allRules.get(name) !== 'function', + (name) => typeof allRules.get(name) !== 'function' ); if (missing.length > 0) { const names = [...allRules.keys()]; throw new RangeError( `Found invalid rule names: ${missing.join( - ', ', - )}. Supported rule names are: ${names.join(', ')}`, + ', ' + )}. Supported rule names are: ${names.join(', ')}` ); } @@ -89,8 +89,8 @@ export default async function lint( if (!Array.isArray(config)) { return new Error( `config for rule ${name} must be array, received ${util.inspect( - config, - )} of type ${typeof config}`, + config + )} of type ${typeof config}` ); } @@ -105,40 +105,40 @@ export default async function lint( if (typeof level !== 'number' || isNaN(level)) { return new Error( `level for rule ${name} must be number, received ${util.inspect( - level, - )} of type ${typeof level}`, + level + )} of type ${typeof level}` ); } if (config.length < 2 || config.length > 3) { return new Error( `config for rule ${name} must be 2 or 3 items long, received ${util.inspect( - config, - )} of length ${config.length}`, + config + )} of length ${config.length}` ); } if (level < 0 || level > 2) { return new RangeError( `level for rule ${name} must be between 0 and 2, received ${util.inspect( - level, - )}`, + level + )}` ); } if (typeof when !== 'string') { return new Error( `condition for rule ${name} must be string, received ${util.inspect( - when, - )} of type ${typeof when}`, + when + )} of type ${typeof when}` ); } if (when !== 'never' && when !== 'always') { return new Error( `condition for rule ${name} must be "always" or "never", received ${util.inspect( - when, - )}`, + when + )}` ); } @@ -176,14 +176,14 @@ export default async function lint( }); const results = (await Promise.all(pendingResults)).filter( - (result): result is LintRuleOutcome => result !== null, + (result): result is LintRuleOutcome => result !== null ); const errors = results.filter( - (result) => result.level === 2 && !result.valid, + (result) => result.level === 2 && !result.valid ); const warnings = results.filter( - (result) => result.level === 1 && !result.valid, + (result) => result.level === 1 && !result.valid ); const valid = errors.length === 0; diff --git a/@commitlint/load/src/load.test.ts b/@commitlint/load/src/load.test.ts index 0ea9bafc0d..a2ec33d1b0 100644 --- a/@commitlint/load/src/load.test.ts +++ b/@commitlint/load/src/load.test.ts @@ -97,7 +97,7 @@ test('plugins should be loaded from local', async () => { test: expect.any(Function), }, }, - }), + }) ); }); @@ -133,7 +133,7 @@ test('local plugins should be loaded from shareable configs', async () => { 'is-positive': expect.any(Function), }, }, - }), + }) ); }); @@ -141,7 +141,7 @@ test('uses seed with parserPreset', async () => { const cwd = await gitBootstrap('fixtures/parser-preset'); const {parserPreset: actual} = await load( {parserPreset: './conventional-changelog-custom'}, - {cwd}, + {cwd} ); expect(actual).toBeDefined(); @@ -426,11 +426,11 @@ test('resolves parser preset from conventional commits', async () => { expect(actual.parserPreset).toBeDefined(); expect(actual.parserPreset!.name).toBe( - 'conventional-changelog-conventionalcommits', + 'conventional-changelog-conventionalcommits' ); expect(typeof actual.parserPreset!.parserOpts).toBe('object'); expect((actual.parserPreset!.parserOpts as any).headerPattern).toEqual( - /^(\w*)(?:\((.*)\))?!?: (.*)$/, + /^(\w*)(?:\((.*)\))?!?: (.*)$/ ); }); @@ -442,16 +442,16 @@ test('resolves parser preset from conventional angular', async () => { expect(actual.parserPreset!.name).toBe('conventional-changelog-angular'); expect(typeof actual.parserPreset!.parserOpts).toBe('object'); expect((actual.parserPreset!.parserOpts as any).headerPattern).toEqual( - /^(\w*)(?:\((.*)\))?: (.*)$/, + /^(\w*)(?:\((.*)\))?: (.*)$/ ); }); test('recursive resolves parser preset from conventional atom', async () => { const cwd = await gitBootstrap( - 'fixtures/recursive-parser-preset-conventional-atom', + 'fixtures/recursive-parser-preset-conventional-atom' ); await npm.installModules( - path.resolve(cwd, 'first-extended', 'second-extended'), + path.resolve(cwd, 'first-extended', 'second-extended') ); const actual = await load({}, {cwd}); @@ -460,23 +460,23 @@ test('recursive resolves parser preset from conventional atom', async () => { expect(actual.parserPreset!.name).toBe('conventional-changelog-atom'); expect(typeof actual.parserPreset!.parserOpts).toBe('object'); expect((actual.parserPreset!.parserOpts as any).headerPattern).toEqual( - /^(:.*?:) (.*)$/, + /^(:.*?:) (.*)$/ ); }); test('resolves parser preset from conventional commits without factory support', async () => { const cwd = await npmBootstrap( - 'fixtures/parser-preset-conventional-without-factory', + 'fixtures/parser-preset-conventional-without-factory' ); const actual = await load({}, {cwd}); expect(actual.parserPreset).toBeDefined(); expect(actual.parserPreset!.name).toBe( - 'conventional-changelog-conventionalcommits', + 'conventional-changelog-conventionalcommits' ); expect(typeof actual.parserPreset!.parserOpts).toBe('object'); expect((actual.parserPreset!.parserOpts as any).headerPattern).toEqual( - /^(\w*)(?:\((.*)\))?!?: (.*)$/, + /^(\w*)(?:\((.*)\))?!?: (.*)$/ ); }); @@ -485,7 +485,7 @@ test('helpUrl should be loaded from the shareable config', async () => { const actual = await load({}, {cwd}); expect(actual.helpUrl).toStrictEqual( - 'https://github.com/conventional-changelog/commitlint', + 'https://github.com/conventional-changelog/commitlint' ); }); @@ -494,6 +494,6 @@ test('default helpUrl should be loaded if not provided in shareable configs', as const actual = await load({}, {cwd}); expect(actual.helpUrl).toStrictEqual( - 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint', + 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint' ); }); diff --git a/@commitlint/load/src/load.ts b/@commitlint/load/src/load.ts index 7f03e6248b..4c927fdc2f 100644 --- a/@commitlint/load/src/load.ts +++ b/@commitlint/load/src/load.ts @@ -19,7 +19,7 @@ import loadPlugin from './utils/load-plugin'; export default async function load( seed: UserConfig = {}, - options: LoadOptions = {}, + options: LoadOptions = {} ): Promise { const cwd = typeof options.cwd === 'undefined' ? process.cwd() : options.cwd; const loaded = await loadConfig(cwd, options.file); @@ -38,7 +38,7 @@ export default async function load( rules: {}, }, config, - seed, + seed ); // Resolve parserPreset key @@ -76,7 +76,7 @@ export default async function load( const rules = ( await Promise.all( - Object.entries(extended.rules || {}).map((entry) => executeRule(entry)), + Object.entries(extended.rules || {}).map((entry) => executeRule(entry)) ) ).reduce((registry, item) => { // type of `item` can be null, but Object.entries always returns key pair diff --git a/@commitlint/load/src/utils/load-config.ts b/@commitlint/load/src/utils/load-config.ts index c5dad119bd..f34ca1c580 100644 --- a/@commitlint/load/src/utils/load-config.ts +++ b/@commitlint/load/src/utils/load-config.ts @@ -10,7 +10,7 @@ export interface LoadConfigResult { export async function loadConfig( cwd: string, - configPath?: string, + configPath?: string ): Promise { const moduleName = 'commitlint'; const tsLoader = TypeScriptLoader(); diff --git a/@commitlint/load/src/utils/load-parser-opts.ts b/@commitlint/load/src/utils/load-parser-opts.ts index 61376d997f..11bcdcb119 100644 --- a/@commitlint/load/src/utils/load-parser-opts.ts +++ b/@commitlint/load/src/utils/load-parser-opts.ts @@ -7,10 +7,10 @@ function isObjectLike(obj: unknown): obj is Record { } function isParserOptsFunction( - obj: T, + obj: T ): obj is T & { parserOpts: ( - cb: (_: never, parserOpts: Record) => unknown, + cb: (_: never, parserOpts: Record) => unknown ) => Record | undefined; } { return typeof obj.parserOpts === 'function'; @@ -21,7 +21,7 @@ export async function loadParserOpts( | string | Awaitable | (() => Awaitable) - | undefined, + | undefined ): Promise { if (typeof pendingParser === 'function') { return loadParserOpts(pendingParser()); diff --git a/@commitlint/load/src/utils/load-plugin.test.ts b/@commitlint/load/src/utils/load-plugin.test.ts index c2f63aa50a..7c78d87f2f 100644 --- a/@commitlint/load/src/utils/load-plugin.test.ts +++ b/@commitlint/load/src/utils/load-plugin.test.ts @@ -17,7 +17,7 @@ jest.mock( }; return {rules: {rule}}; }, - {virtual: true}, + {virtual: true} ); jest.mock( @@ -28,7 +28,7 @@ jest.mock( }; return {rules: {syncRule}}; }, - {virtual: true}, + {virtual: true} ); jest.mock( @@ -39,7 +39,7 @@ jest.mock( }; return {rules: {asyncRule}}; }, - {virtual: true}, + {virtual: true} ); test('should load a plugin when referenced by short name', () => { @@ -69,36 +69,36 @@ test('should load a plugin with an async rule', () => { test('should throw an error when a plugin has whitespace', () => { expect(() => loadPlugin({}, 'whitespace ')).toThrow( - "Whitespace found in plugin name 'whitespace '", + "Whitespace found in plugin name 'whitespace '" ); expect(() => loadPlugin({}, 'whitespace\t')).toThrow( - 'Whitespace found in plugin name', + 'Whitespace found in plugin name' ); expect(() => loadPlugin({}, 'whitespace\n')).toThrow( - 'Whitespace found in plugin name', + 'Whitespace found in plugin name' ); expect(() => loadPlugin({}, 'whitespace\r')).toThrow( - 'Whitespace found in plugin name', + 'Whitespace found in plugin name' ); }); test("should throw an error when a plugin doesn't exist", () => { expect(() => loadPlugin({}, 'nonexistentplugin')).toThrow( - 'Failed to load plugin', + 'Failed to load plugin' ); }); test('should load a scoped plugin when referenced by short name', () => { const plugins = loadPlugin({}, '@scope/example'); expect(plugins['@scope/example']).toBe( - require('@scope/commitlint-plugin-example'), + require('@scope/commitlint-plugin-example') ); }); test('should load a scoped plugin when referenced by long name', () => { const plugins = loadPlugin({}, '@scope/commitlint-plugin-example'); expect(plugins['@scope/example']).toBe( - require('@scope/commitlint-plugin-example'), + require('@scope/commitlint-plugin-example') ); }); diff --git a/@commitlint/load/src/utils/load-plugin.ts b/@commitlint/load/src/utils/load-plugin.ts index 00b0f121c2..f76a19e39d 100644 --- a/@commitlint/load/src/utils/load-plugin.ts +++ b/@commitlint/load/src/utils/load-plugin.ts @@ -7,7 +7,7 @@ import {PluginRecords} from '@commitlint/types'; export default function loadPlugin( plugins: PluginRecords, pluginName: string, - debug: boolean = false, + debug: boolean = false ): PluginRecords { const longName = normalizePackageName(pluginName); const shortName = getShorthandName(longName); @@ -61,8 +61,8 @@ export default function loadPlugin( console.log( chalk.blue( - `Loaded plugin ${pluginName} (${loadedPluginAndVersion}) (from ${resolvedPath})`, - ), + `Loaded plugin ${pluginName} (${loadedPluginAndVersion}) (from ${resolvedPath})` + ) ); } diff --git a/@commitlint/load/src/utils/plugin-naming.ts b/@commitlint/load/src/utils/plugin-naming.ts index 5aafe59650..ecf42784b4 100644 --- a/@commitlint/load/src/utils/plugin-naming.ts +++ b/@commitlint/load/src/utils/plugin-naming.ts @@ -38,14 +38,14 @@ export function normalizePackageName(name: string) { */ const scopedPackageShortcutRegex = new RegExp( `^(@[^/]+)(?:/(?:${prefix})?)?$`, - 'u', + 'u' ), scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, 'u'); if (scopedPackageShortcutRegex.test(normalizedName)) { normalizedName = normalizedName.replace( scopedPackageShortcutRegex, - `$1/${prefix}`, + `$1/${prefix}` ); } else if (!scopedPackageNameRegex.test(normalizedName.split('/')[1])) { /** @@ -54,7 +54,7 @@ export function normalizePackageName(name: string) { */ normalizedName = normalizedName.replace( /^@([^/]+)\/(.*)$/u, - `@$1/${prefix}-$2`, + `@$1/${prefix}-$2` ); } } else if (normalizedName.indexOf(`${prefix}-`) !== 0) { diff --git a/@commitlint/message/src/index.test.ts b/@commitlint/message/src/index.test.ts index f7379262af..04c74201fa 100644 --- a/@commitlint/message/src/index.test.ts +++ b/@commitlint/message/src/index.test.ts @@ -10,6 +10,6 @@ test('should return an empty string for empty input array', () => { test('should filter falsy values', () => { expect(message([null, 'some', undefined, 'message', null])).toBe( - 'some message', + 'some message' ); }); diff --git a/@commitlint/parse/src/index.ts b/@commitlint/parse/src/index.ts index 506e14f33c..52b3ac17a8 100644 --- a/@commitlint/parse/src/index.ts +++ b/@commitlint/parse/src/index.ts @@ -6,7 +6,7 @@ const defaultChangelogOpts = require('conventional-changelog-angular'); export async function parse( message: string, parser: Parser = sync, - parserOpts?: ParserOptions, + parserOpts?: ParserOptions ): Promise { const defaultOpts = (await defaultChangelogOpts).parserOpts; const opts = { diff --git a/@commitlint/prompt/src/input.test.ts b/@commitlint/prompt/src/input.test.ts index df951b5708..cde2a5efb2 100644 --- a/@commitlint/prompt/src/input.test.ts +++ b/@commitlint/prompt/src/input.test.ts @@ -10,7 +10,7 @@ jest.mock( }, { virtual: true, - }, + } ); test('should work with all fields filled', async () => { @@ -56,7 +56,7 @@ test('should fail without type', async () => { expect(message).toEqual(''); expect(console.error).toHaveBeenCalledTimes(1); expect(console.error).toHaveBeenLastCalledWith( - new Error(`⚠ ${chalk.bold('type')} may not be empty.`), + new Error(`⚠ ${chalk.bold('type')} may not be empty.`) ); spy.mockRestore(); }); diff --git a/@commitlint/prompt/src/input.ts b/@commitlint/prompt/src/input.ts index a0c3cd4bc6..702c04608f 100644 --- a/@commitlint/prompt/src/input.ts +++ b/@commitlint/prompt/src/input.ts @@ -21,7 +21,7 @@ export async function input(prompter: PromptModule): Promise { const headerParts = ['type', 'scope', 'subject']; const headerLengthRule = getRules('header', rules).find( - getHasName('max-length'), + getHasName('max-length') ); const maxLength = getMaxLength(headerLengthRule); diff --git a/@commitlint/prompt/src/inquirer/InputCustomPrompt.ts b/@commitlint/prompt/src/inquirer/InputCustomPrompt.ts index ca65f8e2df..7ad5700d81 100644 --- a/@commitlint/prompt/src/inquirer/InputCustomPrompt.ts +++ b/@commitlint/prompt/src/inquirer/InputCustomPrompt.ts @@ -16,7 +16,7 @@ interface KeyDescriptor { } export default class InputCustomPrompt< - TQuestion extends InputCustomOptions = InputCustomOptions, + TQuestion extends InputCustomOptions = InputCustomOptions > extends InputPrompt { private lineSubscription: Subscription; private readonly tabCompletion: string[]; @@ -24,7 +24,7 @@ export default class InputCustomPrompt< constructor( question: TQuestion, readLine: ReadlineInterface, - answers: Answers, + answers: Answers ) { super(question, readLine, answers); @@ -38,7 +38,7 @@ export default class InputCustomPrompt< const events = observe(this.rl); this.lineSubscription = events.keypress.subscribe( - this.onKeyPress2.bind(this), + this.onKeyPress2.bind(this) ); this.tabCompletion = (this.opt.tabCompletion || []) .map((item) => item.value) diff --git a/@commitlint/prompt/src/library/get-forced-case-fn.ts b/@commitlint/prompt/src/library/get-forced-case-fn.ts index 23ffdd0a39..2fb39c607c 100644 --- a/@commitlint/prompt/src/library/get-forced-case-fn.ts +++ b/@commitlint/prompt/src/library/get-forced-case-fn.ts @@ -9,7 +9,7 @@ import type {TargetCaseType} from '@commitlint/types'; * @return transform function applying the enforced case */ export default function getForcedCaseFn( - rule?: RuleEntry, + rule?: RuleEntry ): (input: string) => string { const noop = (input: string) => input; diff --git a/@commitlint/prompt/src/library/get-forced-leading-fn.ts b/@commitlint/prompt/src/library/get-forced-leading-fn.ts index 7356b2ce37..8a37906609 100644 --- a/@commitlint/prompt/src/library/get-forced-leading-fn.ts +++ b/@commitlint/prompt/src/library/get-forced-leading-fn.ts @@ -7,7 +7,7 @@ import {ruleIsActive, ruleIsNotApplicable} from './utils'; * @return transform function applying the leading */ export default function getForcedLeadingFn( - rule?: RuleEntry, + rule?: RuleEntry ): (input: string) => string { if (!rule || !ruleIsActive(rule)) { return (input: string): string => input; diff --git a/@commitlint/prompt/src/library/get-prompt.ts b/@commitlint/prompt/src/library/get-prompt.ts index ecb33798e4..abaf4ce82b 100644 --- a/@commitlint/prompt/src/library/get-prompt.ts +++ b/@commitlint/prompt/src/library/get-prompt.ts @@ -28,7 +28,7 @@ const EOL = '\n'; export default function getPrompt( type: ResultPart, rules: RuleEntry[] = [], - settings: InputSetting = {}, + settings: InputSetting = {} ): InputCustomOptions | null { const emptyRule = rules.filter(getHasName('empty')).find(ruleIsActive); @@ -42,7 +42,7 @@ export default function getPrompt( const forceCaseFn = getForcedCaseFn(rules.find(getHasName('case'))); const forceLeadingBlankFn = getForcedLeadingFn( - rules.find(getHasName('leading-blank')), + rules.find(getHasName('leading-blank')) ); const maxLengthRule = rules.find(getHasName('max-length')); diff --git a/@commitlint/prompt/src/library/meta.ts b/@commitlint/prompt/src/library/meta.ts index dd0f294d49..61c9a412eb 100644 --- a/@commitlint/prompt/src/library/meta.ts +++ b/@commitlint/prompt/src/library/meta.ts @@ -13,6 +13,6 @@ export default function meta(settings: Record): string { const [name, value] = item; return typeof value === 'boolean' ? `[${name}]` : `[${name}=${value}]`; }) - .join(' '), + .join(' ') ); } diff --git a/@commitlint/prompt/src/library/utils.test.ts b/@commitlint/prompt/src/library/utils.test.ts index 10ae36b10e..3d69313456 100644 --- a/@commitlint/prompt/src/library/utils.test.ts +++ b/@commitlint/prompt/src/library/utils.test.ts @@ -44,29 +44,29 @@ test('getRuleName', () => { test('ruleIsActive', () => { expect(ruleIsActive(['', [RuleConfigSeverity.Error, 'always', 100]])).toBe( - true, + true ); expect(ruleIsActive(['', [RuleConfigSeverity.Warning, 'never', 100]])).toBe( - true, + true ); expect(ruleIsActive(['', [RuleConfigSeverity.Disabled, 'always', 100]])).toBe( - false, + false ); expect(ruleIsActive(['', [RuleConfigSeverity.Error]] as any)).toBe(true); }); test('getMaxLength', () => { expect(getMaxLength(['', [RuleConfigSeverity.Error, 'always', 100]])).toBe( - 100, + 100 ); expect(getMaxLength(['', [RuleConfigSeverity.Warning, 'never', 100]])).toBe( - Infinity, + Infinity ); expect(getMaxLength(['', [RuleConfigSeverity.Disabled, 'always', 100]])).toBe( - Infinity, + Infinity ); expect(getMaxLength(['', [RuleConfigSeverity.Error, 100]] as any)).toBe( - Infinity, + Infinity ); const rules: any = { diff --git a/@commitlint/prompt/src/library/utils.ts b/@commitlint/prompt/src/library/utils.ts index bff355329a..089bd1b800 100644 --- a/@commitlint/prompt/src/library/utils.ts +++ b/@commitlint/prompt/src/library/utils.ts @@ -27,7 +27,7 @@ export function getRulePrefix(id: string): string | null { */ export function getHasName(name: string) { return ( - rule: RuleEntry, + rule: RuleEntry ): rule is Exclude => getRuleName(rule[0]) === name; } @@ -37,7 +37,7 @@ export function getHasName(name: string) { * @return if the rule definition is active */ export function ruleIsActive( - rule: T, + rule: T ): rule is Exclude]> { const [, value] = rule; if (value && Array.isArray(value)) { @@ -52,7 +52,7 @@ export function ruleIsActive( * @return if the rule definition is applicable */ export function ruleIsApplicable( - rule: RuleEntry, + rule: RuleEntry ): rule is | [string, Readonly<[RuleConfigSeverity, 'always']>] | [string, Readonly<[RuleConfigSeverity, 'always', unknown]>] { @@ -69,7 +69,7 @@ export function ruleIsApplicable( * @return if the rule definition is applicable */ export function ruleIsNotApplicable( - rule: RuleEntry, + rule: RuleEntry ): rule is | [string, Readonly<[RuleConfigSeverity, 'never']>] | [string, Readonly<[RuleConfigSeverity, 'never', unknown]>] { @@ -81,12 +81,12 @@ export function ruleIsNotApplicable( } export function enumRuleIsActive( - rule: RuleEntry, + rule: RuleEntry ): rule is [ string, Readonly< [RuleConfigSeverity.Warning | RuleConfigSeverity.Error, 'always', string[]] - >, + > ] { return ( ruleIsActive(rule) && @@ -104,7 +104,7 @@ export function enumRuleIsActive( */ export function getRules(prefix: string, rules: QualifiedRules): RuleEntry[] { return Object.entries(rules).filter( - (rule): rule is RuleEntry => getRulePrefix(rule[0]) === prefix, + (rule): rule is RuleEntry => getRulePrefix(rule[0]) === prefix ); } diff --git a/@commitlint/read/src/get-edit-commit.ts b/@commitlint/read/src/get-edit-commit.ts index 246f6e3d74..81041db926 100644 --- a/@commitlint/read/src/get-edit-commit.ts +++ b/@commitlint/read/src/get-edit-commit.ts @@ -5,7 +5,7 @@ import {getEditFilePath} from './get-edit-file-path'; // Get recently edited commit message export async function getEditCommit( cwd?: string, - edit?: boolean | string, + edit?: boolean | string ): Promise { const top = await toplevel(cwd); diff --git a/@commitlint/read/src/get-edit-file-path.ts b/@commitlint/read/src/get-edit-file-path.ts index 3e3836ea41..d90ac6b7b3 100644 --- a/@commitlint/read/src/get-edit-file-path.ts +++ b/@commitlint/read/src/get-edit-file-path.ts @@ -5,7 +5,7 @@ import fs from 'fs-extra'; // Get path to recently edited commit message file export async function getEditFilePath( top: string, - edit?: boolean | string, + edit?: boolean | string ): Promise { if (typeof edit === 'string') { return path.resolve(top, edit); diff --git a/@commitlint/read/src/get-history-commits.ts b/@commitlint/read/src/get-history-commits.ts index 31189c19d3..21616b466f 100644 --- a/@commitlint/read/src/get-history-commits.ts +++ b/@commitlint/read/src/get-history-commits.ts @@ -4,7 +4,7 @@ import {streamToPromise} from './stream-to-promise'; // Get commit messages from history export async function getHistoryCommits( options: gitRawCommits.GitOptions, - opts: {cwd?: string} = {}, + opts: {cwd?: string} = {} ): Promise { return streamToPromise(gitRawCommits(options, {cwd: opts.cwd})); } diff --git a/@commitlint/read/src/read.ts b/@commitlint/read/src/read.ts index 0beb1ed06f..5985bf4463 100644 --- a/@commitlint/read/src/read.ts +++ b/@commitlint/read/src/read.ts @@ -13,7 +13,7 @@ interface GetCommitMessageOptions { // Get commit messages export default async function getCommitMessages( - settings: GetCommitMessageOptions, + settings: GetCommitMessageOptions ): Promise { const {cwd, from, to, edit, gitLogArgs} = settings; diff --git a/@commitlint/read/src/stream-to-promise.ts b/@commitlint/read/src/stream-to-promise.ts index 4c076ec8f9..afa8c63446 100644 --- a/@commitlint/read/src/stream-to-promise.ts +++ b/@commitlint/read/src/stream-to-promise.ts @@ -6,6 +6,6 @@ export function streamToPromise(stream: Readable): Promise { stream .on('data', (chunk) => data.push(chunk.toString('utf-8'))) .on('error', reject) - .on('end', () => resolve(data)), + .on('end', () => resolve(data)) ); } diff --git a/@commitlint/resolve-extends/src/index.test.ts b/@commitlint/resolve-extends/src/index.test.ts index e5ece04f85..3e553ca165 100644 --- a/@commitlint/resolve-extends/src/index.test.ts +++ b/@commitlint/resolve-extends/src/index.test.ts @@ -26,7 +26,7 @@ test('falls back to global install', async () => { test('fails for missing extends', async () => { expect(() => resolveExtends({extends: ['@commitlint/foo-bar']})).toThrow( - /Cannot find module "@commitlint\/foo-bar" from/, + /Cannot find module "@commitlint\/foo-bar" from/ ); }); diff --git a/@commitlint/resolve-extends/src/index.ts b/@commitlint/resolve-extends/src/index.ts index 873d63d71d..8f1c9b6770 100644 --- a/@commitlint/resolve-extends/src/index.ts +++ b/@commitlint/resolve-extends/src/index.ts @@ -19,7 +19,7 @@ export interface ResolveExtendsContext { export default function resolveExtends( config: UserConfig = {}, - context: ResolveExtendsContext = {}, + context: ResolveExtendsContext = {} ): UserConfig { const {extends: e} = config; const extended = loadExtends(config, context); @@ -35,13 +35,13 @@ export default function resolveExtends( return srcValue; } }), - e ? {extends: e} : {}, + e ? {extends: e} : {} ); } function loadExtends( config: UserConfig = {}, - context: ResolveExtendsContext = {}, + context: ResolveExtendsContext = {} ): UserConfig[] { const {extends: e} = config; const ext = e ? (Array.isArray(e) ? e : [e]) : []; @@ -93,7 +93,7 @@ function getId(raw: string = '', prefix: string = ''): string { function resolveConfig( raw: string, - context: ResolveExtendsContext = {}, + context: ResolveExtendsContext = {} ): string { const resolve = context.resolve || resolveId; const id = getId(raw, context.prefix); @@ -104,7 +104,7 @@ function resolveConfig( const legacy = getId(raw, 'conventional-changelog-lint-config'); const resolved = resolve(legacy, context); console.warn( - `Resolving ${raw} to legacy config ${legacy}. To silence this warning raise an issue at 'npm repo ${legacy}' to rename to ${id}.`, + `Resolving ${raw} to legacy config ${legacy}. To silence this warning raise an issue at 'npm repo ${legacy}' to rename to ${id}.` ); return resolved; } @@ -112,7 +112,7 @@ function resolveConfig( function resolveId( id: string, - context: {cwd?: string; resolveGlobal?: (id: string) => string | void} = {}, + context: {cwd?: string; resolveGlobal?: (id: string) => string | void} = {} ): string { const cwd = context.cwd || process.cwd(); const localPath = resolveFromSilent(cwd, id); diff --git a/@commitlint/rules/src/body-case.ts b/@commitlint/rules/src/body-case.ts index b840d8cfee..6c0291c22d 100644 --- a/@commitlint/rules/src/body-case.ts +++ b/@commitlint/rules/src/body-case.ts @@ -7,7 +7,7 @@ const negated = (when?: string) => when === 'never'; export const bodyCase: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { const {body} = parsed; diff --git a/@commitlint/rules/src/body-full-stop.ts b/@commitlint/rules/src/body-full-stop.ts index f0607f6e7c..61d79ec7c8 100644 --- a/@commitlint/rules/src/body-full-stop.ts +++ b/@commitlint/rules/src/body-full-stop.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const bodyFullStop: SyncRule = ( parsed, when = 'always', - value = '.', + value = '.' ) => { const input = parsed.body; diff --git a/@commitlint/rules/src/body-max-length.ts b/@commitlint/rules/src/body-max-length.ts index 632f254869..9121129056 100644 --- a/@commitlint/rules/src/body-max-length.ts +++ b/@commitlint/rules/src/body-max-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const bodyMaxLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.body; diff --git a/@commitlint/rules/src/body-max-line-length.ts b/@commitlint/rules/src/body-max-line-length.ts index 35e53b98ff..5e937ef7e9 100644 --- a/@commitlint/rules/src/body-max-line-length.ts +++ b/@commitlint/rules/src/body-max-line-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const bodyMaxLineLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.body; diff --git a/@commitlint/rules/src/body-min-length.ts b/@commitlint/rules/src/body-min-length.ts index aec4612499..f769e1a4a9 100644 --- a/@commitlint/rules/src/body-min-length.ts +++ b/@commitlint/rules/src/body-min-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const bodyMinLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { if (!parsed.body) { return [true]; diff --git a/@commitlint/rules/src/footer-leading-blank.test.ts b/@commitlint/rules/src/footer-leading-blank.test.ts index 1b6ee82adf..dcfd0430ba 100644 --- a/@commitlint/rules/src/footer-leading-blank.test.ts +++ b/@commitlint/rules/src/footer-leading-blank.test.ts @@ -165,7 +165,7 @@ test('with double blank line before footer and double line in body should succee test('with body containing comments should succeed for "always"', async () => { const [actual] = footerLeadingBlank( await parsed.withBodyWithComment, - 'always', + 'always' ); const expected = true; expect(actual).toEqual(expected); diff --git a/@commitlint/rules/src/footer-max-length.ts b/@commitlint/rules/src/footer-max-length.ts index 88e9d255ca..43520ae546 100644 --- a/@commitlint/rules/src/footer-max-length.ts +++ b/@commitlint/rules/src/footer-max-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const footerMaxLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.footer; diff --git a/@commitlint/rules/src/footer-max-line-length.ts b/@commitlint/rules/src/footer-max-line-length.ts index 338e343831..34aea097dd 100644 --- a/@commitlint/rules/src/footer-max-line-length.ts +++ b/@commitlint/rules/src/footer-max-line-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const footerMaxLineLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.footer; diff --git a/@commitlint/rules/src/footer-min-length.ts b/@commitlint/rules/src/footer-min-length.ts index f4420b2f52..9959cb788c 100644 --- a/@commitlint/rules/src/footer-min-length.ts +++ b/@commitlint/rules/src/footer-min-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const footerMinLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { if (!parsed.footer) { return [true]; diff --git a/@commitlint/rules/src/header-case.test.ts b/@commitlint/rules/src/header-case.test.ts index 824d107a5e..49fcde9dbb 100644 --- a/@commitlint/rules/src/header-case.test.ts +++ b/@commitlint/rules/src/header-case.test.ts @@ -227,7 +227,7 @@ test('should use expected message with "always"', async () => { const [, message] = headerCase( await parsed.uppercase, 'always', - 'lower-case', + 'lower-case' ); expect(message).toContain('must be lower-case'); }); diff --git a/@commitlint/rules/src/header-case.ts b/@commitlint/rules/src/header-case.ts index 73d53c953a..cb907c9e40 100644 --- a/@commitlint/rules/src/header-case.ts +++ b/@commitlint/rules/src/header-case.ts @@ -7,7 +7,7 @@ const negated = (when?: string) => when === 'never'; export const headerCase: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { const {header} = parsed; diff --git a/@commitlint/rules/src/header-full-stop.ts b/@commitlint/rules/src/header-full-stop.ts index 052ce6ccd2..3b2880a9c9 100644 --- a/@commitlint/rules/src/header-full-stop.ts +++ b/@commitlint/rules/src/header-full-stop.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const headerFullStop: SyncRule = ( parsed, when = 'always', - value = '.', + value = '.' ) => { const {header} = parsed; const negated = when === 'never'; diff --git a/@commitlint/rules/src/header-max-length.ts b/@commitlint/rules/src/header-max-length.ts index dbb4744c9b..64855e6615 100644 --- a/@commitlint/rules/src/header-max-length.ts +++ b/@commitlint/rules/src/header-max-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const headerMaxLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { return [ maxLength(parsed.header, value), diff --git a/@commitlint/rules/src/header-min-length.ts b/@commitlint/rules/src/header-min-length.ts index 3a71d3add7..cc84ef56e7 100644 --- a/@commitlint/rules/src/header-min-length.ts +++ b/@commitlint/rules/src/header-min-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const headerMinLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { return [ minLength(parsed.header, value), diff --git a/@commitlint/rules/src/index.test.ts b/@commitlint/rules/src/index.test.ts index 09f6dad0c0..e31802ebd8 100644 --- a/@commitlint/rules/src/index.test.ts +++ b/@commitlint/rules/src/index.test.ts @@ -17,7 +17,7 @@ test('rules export functions', () => { test('all rules are present in documentation', () => { const file = fs.readFileSync( path.join(__dirname, '../../../docs/reference-rules.md'), - 'utf-8', + 'utf-8' ); const results = file .split(/(\n|\r)/) diff --git a/@commitlint/rules/src/scope-case.ts b/@commitlint/rules/src/scope-case.ts index f5177e631e..9bac0d3db2 100644 --- a/@commitlint/rules/src/scope-case.ts +++ b/@commitlint/rules/src/scope-case.ts @@ -7,7 +7,7 @@ const negated = (when?: string) => when === 'never'; export const scopeCase: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { const {scope} = parsed; @@ -32,7 +32,7 @@ export const scopeCase: SyncRule = ( const result = checks.some((check) => { const r = scopeSegments.every( - (segment) => delimiters.test(segment) || ensureCase(segment, check.case), + (segment) => delimiters.test(segment) || ensureCase(segment, check.case) ); return negated(check.when) ? !r : r; diff --git a/@commitlint/rules/src/scope-enum.ts b/@commitlint/rules/src/scope-enum.ts index 9fc36a9726..e368df5a6a 100644 --- a/@commitlint/rules/src/scope-enum.ts +++ b/@commitlint/rules/src/scope-enum.ts @@ -5,7 +5,7 @@ import {SyncRule} from '@commitlint/types'; export const scopeEnum: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { if (!parsed.scope) { return [true, '']; diff --git a/@commitlint/rules/src/scope-max-length.ts b/@commitlint/rules/src/scope-max-length.ts index de0174273e..917d548f91 100644 --- a/@commitlint/rules/src/scope-max-length.ts +++ b/@commitlint/rules/src/scope-max-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const scopeMaxLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.scope; diff --git a/@commitlint/rules/src/scope-min-length.ts b/@commitlint/rules/src/scope-min-length.ts index bcbac327ef..55a69da3e9 100644 --- a/@commitlint/rules/src/scope-min-length.ts +++ b/@commitlint/rules/src/scope-min-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const scopeMinLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.scope; if (!input) { diff --git a/@commitlint/rules/src/signed-off-by.test.ts b/@commitlint/rules/src/signed-off-by.test.ts index d5f1d9ebb6..29fc665501 100644 --- a/@commitlint/rules/src/signed-off-by.test.ts +++ b/@commitlint/rules/src/signed-off-by.test.ts @@ -55,7 +55,7 @@ test('without against "always signed-off-by" should fail', async () => { const [actual] = signedOffBy( await parsed.without, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = false; expect(actual).toEqual(expected); @@ -71,7 +71,7 @@ test('trailing comments should be ignored', async () => { const [actual] = signedOffBy( await parsed.withSignoffAndComments, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = true; expect(actual).toEqual(expected); @@ -81,7 +81,7 @@ test('inSubject against "always signed-off-by" should fail', async () => { const [actual] = signedOffBy( await parsed.inSubject, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = false; expect(actual).toEqual(expected); @@ -91,7 +91,7 @@ test('inSubject against "never signed-off-by" should succeed', async () => { const [actual] = signedOffBy( await parsed.inSubject, 'never', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = true; expect(actual).toEqual(expected); diff --git a/@commitlint/rules/src/signed-off-by.ts b/@commitlint/rules/src/signed-off-by.ts index db7ed341a6..674a206197 100644 --- a/@commitlint/rules/src/signed-off-by.ts +++ b/@commitlint/rules/src/signed-off-by.ts @@ -5,14 +5,14 @@ import {SyncRule} from '@commitlint/types'; export const signedOffBy: SyncRule = ( parsed, when = 'always', - value = '', + value = '' ) => { const lines = toLines(parsed.raw).filter( (ln) => // skip comments !ln.startsWith('#') && // ignore empty lines - Boolean(ln), + Boolean(ln) ); const last = lines[lines.length - 1]; diff --git a/@commitlint/rules/src/subject-case.test.ts b/@commitlint/rules/src/subject-case.test.ts index 224f9d8644..d7054f3a0f 100644 --- a/@commitlint/rules/src/subject-case.test.ts +++ b/@commitlint/rules/src/subject-case.test.ts @@ -87,7 +87,7 @@ test('with lowercase unicode subject should fail for "always uppercase"', async const [actual] = subjectCase( await parsed.lowercase_unicode, 'always', - 'upper-case', + 'upper-case' ); const expected = false; expect(actual).toEqual(expected); @@ -151,7 +151,7 @@ test('with uppercase unicode subject should fail for "always lowercase"', async const [actual] = subjectCase( await parsed.uppercase_unicode, 'always', - 'lower-case', + 'lower-case' ); const expected = false; expect(actual).toEqual(expected); @@ -197,7 +197,7 @@ test('with camelcase unicode subject should fail for "always sentencecase"', asy const [actual] = subjectCase( await parsed.camelcase_unicode, 'always', - 'sentence-case', + 'sentence-case' ); const expected = false; expect(actual).toEqual(expected); @@ -207,7 +207,7 @@ test('with kebabcase unicode subject should fail for "always camelcase"', async const [actual] = subjectCase( await parsed.kebabcase_unicode, 'always', - 'camel-case', + 'camel-case' ); const expected = false; expect(actual).toEqual(expected); @@ -229,7 +229,7 @@ test('with pascalcase subject should succeed for "always pascalcase"', async () const [actual] = subjectCase( await parsed.pascalcase, 'always', - 'pascal-case', + 'pascal-case' ); const expected = true; expect(actual).toEqual(expected); @@ -257,7 +257,7 @@ test('with pascalcase unicode subject should fail for "always uppercase"', async const [actual] = subjectCase( await parsed.pascalcase_unicode, 'always', - 'upper-case', + 'upper-case' ); const expected = false; expect(actual).toEqual(expected); @@ -303,7 +303,7 @@ test('with snakecase unicode subject should fail for "never lowercase"', async ( const [actual] = subjectCase( await parsed.snakecase_unicode, 'never', - 'lower-case', + 'lower-case' ); const expected = false; expect(actual).toEqual(expected); @@ -355,7 +355,7 @@ test('with startcase unicode subject should fail for "always pascalcase"', async const [actual] = subjectCase( await parsed.startcase_unicode, 'always', - 'pascal-case', + 'pascal-case' ); const expected = false; expect(actual).toEqual(expected); @@ -365,7 +365,7 @@ test('with sentencecase subject should succeed for "always sentence-case"', asyn const [actual] = subjectCase( await parsed.sentencecase, 'always', - 'sentence-case', + 'sentence-case' ); const expected = true; expect(actual).toEqual(expected); @@ -375,7 +375,7 @@ test('with sentencecase subject should fail for "never sentencecase"', async () const [actual] = subjectCase( await parsed.sentencecase, 'never', - 'sentence-case', + 'sentence-case' ); const expected = false; expect(actual).toEqual(expected); @@ -385,7 +385,7 @@ test('with sentencecase subject should fail for "always pascalcase"', async () = const [actual] = subjectCase( await parsed.sentencecase, 'always', - 'pascal-case', + 'pascal-case' ); const expected = false; expect(actual).toEqual(expected); @@ -395,7 +395,7 @@ test('with sentencecase subject should succeed for "never camelcase"', async () const [actual] = subjectCase( await parsed.sentencecase, 'never', - 'camel-case', + 'camel-case' ); const expected = true; expect(actual).toEqual(expected); @@ -405,7 +405,7 @@ test('with sentencecase unicode subject should fail for "always camelcase"', asy const [actual] = subjectCase( await parsed.sentencecase_unicode, 'always', - 'camel-case', + 'camel-case' ); const expected = false; expect(actual).toEqual(expected); @@ -415,7 +415,7 @@ test('should use expected message with "always"', async () => { const [, message] = subjectCase( await parsed.uppercase, 'always', - 'lower-case', + 'lower-case' ); expect(message).toContain('must be lower-case'); }); @@ -424,7 +424,7 @@ test('should use expected message with "never"', async () => { const [, message] = subjectCase( await parsed.uppercase, 'never', - 'upper-case', + 'upper-case' ); expect(message).toContain('must not be upper-case'); }); diff --git a/@commitlint/rules/src/subject-case.ts b/@commitlint/rules/src/subject-case.ts index 3c3d3fe682..13e7de850a 100644 --- a/@commitlint/rules/src/subject-case.ts +++ b/@commitlint/rules/src/subject-case.ts @@ -24,7 +24,7 @@ const negated = (when?: string) => when === 'never'; export const subjectCase: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { const {subject} = parsed; diff --git a/@commitlint/rules/src/subject-full-stop.test.ts b/@commitlint/rules/src/subject-full-stop.test.ts index 0f17fa4cf2..fadae4ac85 100644 --- a/@commitlint/rules/src/subject-full-stop.test.ts +++ b/@commitlint/rules/src/subject-full-stop.test.ts @@ -57,7 +57,7 @@ test('commit message title with standard scope and full-stop against "never ." s const [actual] = subjectFullStop( await parsed.standardScopeWith, 'never', - '.', + '.' ); const expected = false; expect(actual).toEqual(expected); @@ -67,7 +67,7 @@ test('commit message title with non standard scope and full-stop against "never const [actual] = subjectFullStop( await parsed.nonStandardScopeWith, 'never', - '.', + '.' ); const expected = false; expect(actual).toEqual(expected); diff --git a/@commitlint/rules/src/subject-full-stop.ts b/@commitlint/rules/src/subject-full-stop.ts index 040d78ed38..c00161f5ab 100644 --- a/@commitlint/rules/src/subject-full-stop.ts +++ b/@commitlint/rules/src/subject-full-stop.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const subjectFullStop: SyncRule = ( parsed, when = 'always', - value = '.', + value = '.' ) => { const colonIndex = parsed.header.indexOf(':'); if (colonIndex > 0 && colonIndex === parsed.header.length - 1) { diff --git a/@commitlint/rules/src/subject-max-length.ts b/@commitlint/rules/src/subject-max-length.ts index f07d331afa..86d27ed60c 100644 --- a/@commitlint/rules/src/subject-max-length.ts +++ b/@commitlint/rules/src/subject-max-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const subjectMaxLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.subject; diff --git a/@commitlint/rules/src/subject-min-length.ts b/@commitlint/rules/src/subject-min-length.ts index c92e6c81d0..98310a4fb3 100644 --- a/@commitlint/rules/src/subject-min-length.ts +++ b/@commitlint/rules/src/subject-min-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const subjectMinLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.subject; if (!input) { diff --git a/@commitlint/rules/src/trailer-exists.test.ts b/@commitlint/rules/src/trailer-exists.test.ts index 8773501f58..f97ab83be1 100644 --- a/@commitlint/rules/src/trailer-exists.test.ts +++ b/@commitlint/rules/src/trailer-exists.test.ts @@ -33,7 +33,7 @@ test('empty against "always trailer-exists" should fail', async () => { const [actual] = trailerExists( await parsed.empty, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = false; @@ -62,7 +62,7 @@ test('without against "always trailer-exists" should fail', async () => { const [actual] = trailerExists( await parsed.without, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = false; @@ -73,7 +73,7 @@ test('without against "never trailer-exists" should succeed', async () => { const [actual] = trailerExists( await parsed.without, 'never', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = true; @@ -84,7 +84,7 @@ test('comments and other trailers should be ignored', async () => { const [actual] = trailerExists( await parsed.withSignoffAndNoise, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = true; @@ -95,7 +95,7 @@ test('inSubject against "always trailer-exists" should fail', async () => { const [actual] = trailerExists( await parsed.inSubject, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = false; @@ -106,7 +106,7 @@ test('inSubject against "never trailer-exists" should succeed', async () => { const [actual] = trailerExists( await parsed.inSubject, 'never', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = true; @@ -117,7 +117,7 @@ test('inBody against "always trailer-exists" should fail', async () => { const [actual] = trailerExists( await parsed.inBody, 'always', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = false; @@ -128,7 +128,7 @@ test('inBody against "never trailer-exists" should succeed', async () => { const [actual] = trailerExists( await parsed.inBody, 'never', - 'Signed-off-by:', + 'Signed-off-by:' ); const expected = true; diff --git a/@commitlint/rules/src/trailer-exists.ts b/@commitlint/rules/src/trailer-exists.ts index b4d1bd4253..2b78da87a8 100644 --- a/@commitlint/rules/src/trailer-exists.ts +++ b/@commitlint/rules/src/trailer-exists.ts @@ -6,7 +6,7 @@ import {SyncRule} from '@commitlint/types'; export const trailerExists: SyncRule = ( parsed, when = 'always', - value = '', + value = '' ) => { const trailers = execa.sync('git', ['interpret-trailers', '--parse'], { input: parsed.raw, diff --git a/@commitlint/rules/src/type-case.ts b/@commitlint/rules/src/type-case.ts index f4ae1da019..71aa2fafdc 100644 --- a/@commitlint/rules/src/type-case.ts +++ b/@commitlint/rules/src/type-case.ts @@ -7,7 +7,7 @@ const negated = (when?: string) => when === 'never'; export const typeCase: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { const {type} = parsed; diff --git a/@commitlint/rules/src/type-enum.ts b/@commitlint/rules/src/type-enum.ts index 4e509c1edb..c4a8f9aa18 100644 --- a/@commitlint/rules/src/type-enum.ts +++ b/@commitlint/rules/src/type-enum.ts @@ -5,7 +5,7 @@ import {SyncRule} from '@commitlint/types'; export const typeEnum: SyncRule = ( parsed, when = 'always', - value = [], + value = [] ) => { const {type: input} = parsed; diff --git a/@commitlint/rules/src/type-max-length.ts b/@commitlint/rules/src/type-max-length.ts index 016af9cde8..1e4d27766f 100644 --- a/@commitlint/rules/src/type-max-length.ts +++ b/@commitlint/rules/src/type-max-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const typeMaxLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.type; diff --git a/@commitlint/rules/src/type-min-length.ts b/@commitlint/rules/src/type-min-length.ts index c05370003a..f7ff3ea38b 100644 --- a/@commitlint/rules/src/type-min-length.ts +++ b/@commitlint/rules/src/type-min-length.ts @@ -4,7 +4,7 @@ import {SyncRule} from '@commitlint/types'; export const typeMinLength: SyncRule = ( parsed, _when = undefined, - value = 0, + value = 0 ) => { const input = parsed.type; if (!input) { diff --git a/@commitlint/travis-cli/src/cli.test.ts b/@commitlint/travis-cli/src/cli.test.ts index 83f507487f..cd7d7704d1 100644 --- a/@commitlint/travis-cli/src/cli.test.ts +++ b/@commitlint/travis-cli/src/cli.test.ts @@ -29,7 +29,7 @@ const cli = async (config: execa.Options = {}, args: string[] = []) => { throw new Error([err.stdout, err.stderr].join('\n')); } else { throw new Error( - `An unknown error occured while running '${bin} ${args.join(' ')}'`, + `An unknown error occured while running '${bin} ${args.join(' ')}'` ); } } @@ -42,7 +42,7 @@ test('should throw when not on travis ci', async () => { }; await expect(cli({env})).rejects.toThrow( - '@commitlint/travis-cli is intended to be used on Travis CI', + '@commitlint/travis-cli is intended to be used on Travis CI' ); }); @@ -53,7 +53,7 @@ test('should throw when on travis ci, but env vars are missing', async () => { }; await expect(cli({env})).rejects.toThrow( - 'TRAVIS_COMMIT, TRAVIS_COMMIT_RANGE, TRAVIS_EVENT_TYPE, TRAVIS_REPO_SLUG, TRAVIS_PULL_REQUEST_SLUG', + 'TRAVIS_COMMIT, TRAVIS_COMMIT_RANGE, TRAVIS_EVENT_TYPE, TRAVIS_REPO_SLUG, TRAVIS_PULL_REQUEST_SLUG' ); }); @@ -62,7 +62,7 @@ test('should call git with expected args', async () => { 'https://github.com/conventional-changelog/commitlint.git', ['--depth=10'], __dirname, - TRAVIS_COMMITLINT_GIT_BIN, + TRAVIS_COMMITLINT_GIT_BIN ); const result = await cli({ @@ -84,7 +84,7 @@ test('should call git with expected args on pull_request', async () => { 'https://github.com/conventional-changelog/commitlint.git', ['--depth=10'], __dirname, - TRAVIS_COMMITLINT_GIT_BIN, + TRAVIS_COMMITLINT_GIT_BIN ); const result = await cli({ @@ -112,7 +112,7 @@ test('should call git with extra expected args on pull_request', async () => { 'https://github.com/conventional-changelog/commitlint.git', ['--depth=10'], __dirname, - TRAVIS_COMMITLINT_GIT_BIN, + TRAVIS_COMMITLINT_GIT_BIN ); const result = await cli( @@ -120,7 +120,7 @@ test('should call git with extra expected args on pull_request', async () => { cwd, env: {...validBaseEnv, TRAVIS_EVENT_TYPE: 'pull_request'}, }, - ['--config', './config/commitlint.config.js'], + ['--config', './config/commitlint.config.js'] ); const invocations = await getInvocations(result.stdout); expect(invocations.length).toBe(3); @@ -151,6 +151,6 @@ function getInvocations(stdout: string): string[][] { .split(',') .map((fragment) => fragment.trim()) .map((fragment) => fragment.substring(1, fragment.length - 1)) - .filter(Boolean), + .filter(Boolean) ); } diff --git a/@commitlint/travis-cli/src/cli.ts b/@commitlint/travis-cli/src/cli.ts index f5ce70c476..22ccea6c87 100644 --- a/@commitlint/travis-cli/src/cli.ts +++ b/@commitlint/travis-cli/src/cli.ts @@ -97,7 +97,7 @@ async function stash() { function validate() { if (process.env.CI !== 'true' || process.env.TRAVIS !== 'true') { throw new Error( - `@commitlint/travis-cli is intended to be used on Travis CI`, + `@commitlint/travis-cli is intended to be used on Travis CI` ); } @@ -106,7 +106,7 @@ function validate() { if (missing.length > 0) { const stanza = missing.length > 1 ? 'they were not' : 'it was not'; throw new Error( - `Expected ${missing.join(', ')} to be defined globally, ${stanza}.`, + `Expected ${missing.join(', ')} to be defined globally, ${stanza}.` ); } } diff --git a/@commitlint/types/src/format.ts b/@commitlint/types/src/format.ts index cee98cbbad..7180cb3b82 100644 --- a/@commitlint/types/src/format.ts +++ b/@commitlint/types/src/format.ts @@ -4,7 +4,7 @@ import {RuleConfigSeverity} from './rules'; export type Formatter = ( report: FormattableReport, - options: FormatOptions, + options: FormatOptions ) => string; export interface FormattableProblem { diff --git a/@commitlint/types/src/parse.ts b/@commitlint/types/src/parse.ts index 99f4447249..3eb026247e 100644 --- a/@commitlint/types/src/parse.ts +++ b/@commitlint/types/src/parse.ts @@ -29,7 +29,7 @@ export interface CommitReference { export type Parser = ( message: string, - options: ParserOptions, + options: ParserOptions ) => Omit; export interface ParserOptions { diff --git a/@commitlint/types/src/rules.ts b/@commitlint/types/src/rules.ts index 60f13c4563..d0df4d0402 100644 --- a/@commitlint/types/src/rules.ts +++ b/@commitlint/types/src/rules.ts @@ -17,7 +17,7 @@ export type RuleType = 'async' | 'sync' | 'either'; export type BaseRule = ( parsed: Commit, when?: RuleConfigCondition, - value?: Value, + value?: Value ) => Type extends 'either' ? RuleOutcome | Promise : Type extends 'async' @@ -70,7 +70,7 @@ export type QualifiedRuleConfig = export type RuleConfig< V = RuleConfigQuality.Qualified, - T = void, + T = void > = V extends RuleConfigQuality.Qualified ? RuleConfigTuple : QualifiedRuleConfig; diff --git a/@packages/test/src/git.ts b/@packages/test/src/git.ts index 6f09c5b8a4..e0ba9f7dbd 100644 --- a/@packages/test/src/git.ts +++ b/@packages/test/src/git.ts @@ -13,7 +13,7 @@ export async function clone( source: string, args: string[], directory?: string, - gitCommand = 'git', + gitCommand = 'git' ) { const cwd = await fix.bootstrap(undefined, directory); diff --git a/@packages/test/src/npm.ts b/@packages/test/src/npm.ts index ac93516535..5e7da3a4ee 100644 --- a/@packages/test/src/npm.ts +++ b/@packages/test/src/npm.ts @@ -10,7 +10,7 @@ export async function installModules(cwd: string) { if (await fs.pathExists(manifestPath)) { const {dependencies = {}, devDependencies = {}} = await fs.readJson( - manifestPath, + manifestPath ); const deps = Object.keys({...dependencies, ...devDependencies}); await Promise.all( @@ -32,7 +32,7 @@ export async function installModules(cwd: string) { await fs.mkdirp(path.join(targetPath, '..')); await fs.symlink(sourcePath, targetPath); - }), + }) ); } } @@ -45,7 +45,7 @@ export async function bootstrap(fixture: string, directory?: string) { function findParentPath( parentPath: string, - dirname: string, + dirname: string ): string | undefined { const rawFragments = parentPath.split(path.sep); @@ -61,7 +61,7 @@ function findParentPath( return {fragments, matched}; }, - {fragments: rawFragments, matched: false}, + {fragments: rawFragments, matched: false} ); return matched ? fragments.join(path.sep) : undefined; diff --git a/docs/reference-api.md b/docs/reference-api.md index c73d1521d6..794ceb3315 100644 --- a/docs/reference-api.md +++ b/docs/reference-api.md @@ -104,7 +104,7 @@ format( }, { color: false, - }, + } ); /* => [ '✖ This will show up red as it has level 2 [some-error]', @@ -258,12 +258,12 @@ load({extends: ['./package']}).then((config) => console.log(config)); // => { extends: ['./package', './package-b'], rules: {} } load({parserPreset: './parser-preset.js'}).then((config) => - console.log(config), + console.log(config) ); // => { extends: [], rules: {}, parserPreset: {name: './parser-preset.js', path: './parser-preset.js', opts: {}}} load({}, {file: '.commitlintrc.yml', cwd: process.cwd()}).then((config) => - console.log(config), + console.log(config) ); // => { extends: [], rules: { 'body-leading-blank': [ 1, 'always' ] }, formatter: '@commitlint/format', plugins: {} } ``` @@ -305,7 +305,7 @@ read({edit: true}).then((messages) => console.log(messages)); // => ['I did something\n\n'] read({edit: './git/GITGUI_EDITMESSAGE'}).then((messages) => - console.log(messages), + console.log(messages) ); // => ['I did something via git gui\n\n'] @@ -369,12 +369,12 @@ lint('foo: bar').then((report) => console.log(report)); // => { valid: true, errors: [], warnings: [] } lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then((report) => - console.log(report), + console.log(report) ); // => { valid: true, errors: [], warnings: [] } lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then((report) => - console.log(report), + console.log(report) ); /* => { valid: true, @@ -394,7 +394,7 @@ const opts = { }; lint('foo-bar', {'type-enum': [2, 'always', ['foo']]}, opts).then((report) => - console.log(report), + console.log(report) ); // => { valid: true, errors: [], warnings: [] } ``` @@ -414,8 +414,8 @@ load(CONFIG) lint( 'foo: bar', opts.rules, - opts.parserPreset ? {parserOpts: opts.parserPreset.parserOpts} : {}, - ), + opts.parserPreset ? {parserOpts: opts.parserPreset.parserOpts} : {} + ) ) .then((report) => console.log(report)); /* => @@ -442,7 +442,7 @@ const RULES = { const check = (commit) => lint(commit, RULES); read({to: 'HEAD', from: 'HEAD~2'}).then((commits) => - Promise.all(commits.map(check)), + Promise.all(commits.map(check)) ); ``` @@ -459,7 +459,7 @@ Promise.all([load(), read({from: 'HEAD~1'})]) return lint( commit, rules, - parserPreset ? {parserOpts: parserPreset.parserOpts} : {}, + parserPreset ? {parserOpts: parserPreset.parserOpts} : {} ); }) .then((report) => console.log(JSON.stringify(result.valid)));