Skip to content

chore: deps and prettier v3 changes #3632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions @commitlint/cli/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down Expand Up @@ -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();
Expand All @@ -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();
});
Expand All @@ -177,15 +177,15 @@ 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
await execa('git', ['add', 'package.json'], {cwd});
const commit = await execa(
'git',
['commit', '-m', '"test: this should work"'],
{cwd}
{cwd},
);
expect(commit).toBeTruthy();
});
Expand All @@ -194,15 +194,15 @@ 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
await execa('git', ['add', 'package.json'], {cwd});
const commit = await execa(
'git',
['commit', '-m', '"test: this should work"'],
{cwd}
{cwd},
);
expect(commit).toBeTruthy();
});
Expand All @@ -211,15 +211,15 @@ 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
await execa('git', ['add', 'package.json'], {cwd});
const commit = await execa(
'git',
['commit', '-m', '"test: this should work"'],
{cwd}
{cwd},
);
expect(commit).toBeTruthy();
});
Expand All @@ -228,15 +228,15 @@ 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
await execa('git', ['add', 'package.json'], {cwd});
const commit = await execa(
'git',
['commit', '-m', '"test: this should work"'],
{cwd}
{cwd},
);
expect(commit).toBeTruthy();
});
Expand All @@ -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,
Expand All @@ -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');
Expand All @@ -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);
});
Expand Down Expand Up @@ -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});

Expand All @@ -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})();
Expand All @@ -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})();
Expand All @@ -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})();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -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');
Expand Down
18 changes: 9 additions & 9 deletions @commitlint/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -204,7 +204,7 @@ async function main(args: MainArgs): Promise<void> {
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);
Expand Down Expand Up @@ -249,15 +249,15 @@ async function main(args: MainArgs): Promise<void> {
if (!execaError.failed || execaError.exitCode !== 1) {
console.warn(
'Could not determine core.commentChar git configuration',
e
e,
);
}
opts.parserOpts.commentChar = gitDefaultCommentChar;
}
}

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) {
Expand Down Expand Up @@ -305,7 +305,7 @@ async function main(args: MainArgs): Promise<void> {
errorCount: 0,
warningCount: 0,
results: [],
}
},
);

const helpUrl = flags['help-url']?.trim() || loaded.helpUrl;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -395,15 +395,15 @@ 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;
}

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']}
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/config-conventional/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@commitlint/utils": "^17.4.0"
},
"dependencies": {
"conventional-changelog-conventionalcommits": "^5.0.0"
"conventional-changelog-conventionalcommits": "^6.1.0"
},
"gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc"
}
2 changes: 1 addition & 1 deletion @commitlint/config-lerna-scopes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@lerna/project": "^6.0.0",
"glob": "^8.0.3",
"import-from": "4.0.0",
"semver": "7.5.2"
"semver": "7.5.4"
},
"devDependencies": {
"@commitlint/test": "^17.4.2",
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/config-pnpm-scopes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"dependencies": {
"@pnpm/read-project-manifest": "^4.1.4",
"fast-glob": "^3.2.12",
"fast-glob": "^3.3.1",
"read-yaml-file": "^2.1.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions @commitlint/config-validator/src/formatErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/config-validator/src/validate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
6 changes: 3 additions & 3 deletions @commitlint/config-validator/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)}`,
);
}
}
2 changes: 1 addition & 1 deletion @commitlint/cz-commitlint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@commitlint/types": "^17.4.4",
"chalk": "^4.1.0",
"lodash.isplainobject": "^4.0.6",
"word-wrap": "^1.2.3"
"word-wrap": "^1.2.5"
},
"peerDependencies": {
"commitizen": "^4.0.3",
Expand Down
Loading