Skip to content
Draft
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
1 change: 1 addition & 0 deletions @commitlint/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"lodash.merge": "^4.6.2"
},
"dependencies": {
"conventional-commits-parser": "^6.0.0",
"@commitlint/format": "^19.3.0",
"@commitlint/lint": "^19.2.2",
"@commitlint/load": "^19.2.0",
Expand Down
4 changes: 2 additions & 2 deletions @commitlint/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
QualifiedConfig,
UserConfig,
} from '@commitlint/types';
import type {Options} from 'conventional-commits-parser';
import type {ParserOptions} from 'conventional-commits-parser';
import {execa, type ExecaError} from 'execa';
import yargs, {type Arguments} from 'yargs';

Expand Down Expand Up @@ -263,7 +263,7 @@ async function main(args: MainArgs): Promise<void> {
file: flags.config,
});
const parserOpts = selectParserOpts(loaded.parserPreset);
const opts: LintOptions & {parserOpts: Options} = {
const opts: LintOptions & {parserOpts: ParserOptions} = {
parserOpts: {},
plugins: {},
ignores: [],
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 @@ -40,7 +40,7 @@
},
"dependencies": {
"@commitlint/types": "^19.0.3",
"conventional-changelog-conventionalcommits": "^7.0.2"
"conventional-changelog-conventionalcommits": "^8.0.0"
},
"gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "parser-preset-angular",
"version": "1.0.0",
"devDependencies": {
"conventional-changelog-angular": "^7.0.0"
"conventional-changelog-angular": "^8.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "parser-preset-conventional-without-factory",
"version": "1.0.0",
"devDependencies": {
"conventional-changelog-conventionalcommits": "^7.0.2"
"conventional-changelog-conventionalcommits": "^8.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "parser-preset-conventionalcommits",
"version": "1.0.0",
"devDependencies": {
"conventional-changelog-conventionalcommits": "^7.0.2"
"conventional-changelog-conventionalcommits": "^8.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "@second-extend/recursive-parser-preset-conventional-atom",
"version": "1.0.0",
"devDependencies": {
"conventional-changelog-atom": "^2.0.3"
"conventional-changelog-atom": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion @commitlint/load/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@types/lodash.merge": "^4.6.8",
"@types/lodash.uniq": "^4.5.8",
"@types/node": "^18.19.17",
"conventional-changelog-atom": "^4.0.0",
"conventional-changelog-atom": "^5.0.0",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
7 changes: 3 additions & 4 deletions @commitlint/parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@
"license": "MIT",
"devDependencies": {
"@commitlint/test": "^19.0.0",
"@commitlint/utils": "^19.0.0",
"@types/conventional-commits-parser": "^5.0.0"
"@commitlint/utils": "^19.0.0"
},
"dependencies": {
"@commitlint/types": "^19.0.3",
"conventional-changelog-angular": "^7.0.0",
"conventional-commits-parser": "^5.0.0"
"conventional-changelog-angular": "^8.0.0",
"conventional-commits-parser": "^6.0.0"
},
"gitHead": "70f7f4688b51774e7ac5e40e896cdaa3f132b2bc"
}
21 changes: 17 additions & 4 deletions @commitlint/parse/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import {
type Commit,
type ParserOptions,
CommitParser,
} from 'conventional-commits-parser';
import type {Parser} from '@commitlint/types';

import {type Commit, type Options, sync} from 'conventional-commits-parser';
// @ts-expect-error -- no typings
import defaultChangelogOpts from 'conventional-changelog-angular';

export async function parse(
message: string,
parser: Parser = sync,
parserOpts?: Options
parser?: Parser,
parserOpts?: ParserOptions
): Promise<Commit> {
const preset = await defaultChangelogOpts();
const defaultOpts = preset.parserOpts;
Expand All @@ -16,7 +20,16 @@ export async function parse(
fieldPattern: null,
...(parserOpts || {}),
};
const parsed = parser(message, opts) as Commit;

let parsed;

if (parser) {
parsed = parser(message, opts) as Commit;
} else {
const defaultParser = new CommitParser(opts);
parsed = defaultParser.parse(message) as Commit;
}

parsed.raw = message;
return parsed;
}
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@commitlint/parse": "^19.0.3",
"@commitlint/test": "^19.0.0",
"@commitlint/utils": "^19.0.0",
"conventional-changelog-angular": "^7.0.0",
"conventional-changelog-angular": "^8.0.0",
"glob": "^10.3.10"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion @commitlint/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"license": "MIT",
"dependencies": {
"@types/conventional-commits-parser": "^5.0.0",
"conventional-commits-parser": "^6.0.0",
"chalk": "^5.3.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions @commitlint/types/src/lint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Options} from 'conventional-commits-parser';
import type {ParserOptions} from 'conventional-commits-parser';
import {IsIgnoredOptions} from './is-ignored.js';
import {PluginRecords} from './load.js';
import {RuleConfigSeverity, RuleConfigTuple} from './rules.js';
Expand All @@ -16,7 +16,7 @@ export interface LintOptions {
/** Additional commits to ignore, defined by ignore matchers */
ignores?: IsIgnoredOptions['ignores'];
/** The parser configuration to use when linting the commit */
parserOpts?: Options;
parserOpts?: ParserOptions;

plugins?: PluginRecords;
helpUrl?: string;
Expand Down
7 changes: 5 additions & 2 deletions @commitlint/types/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type {Commit, Options} from 'conventional-commits-parser';
import type {Commit, ParserOptions} from 'conventional-commits-parser';

export type Parser = (message: string, options: Options) => Omit<Commit, 'raw'>;
export type Parser = (
message: string,
options: ParserOptions
) => Omit<Commit, 'raw'>;
63 changes: 23 additions & 40 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1912,13 +1912,6 @@
resolved "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz"
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==

"@types/conventional-commits-parser@^5.0.0":
version "5.0.0"
resolved "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz#8c9d23e0b415b24b91626d07017303755d542dc8"
integrity sha512-loB369iXNmAZglwWATL+WRe+CRMmmBPtpolYzIebFaX4YA3x+BEfLqhUAV9WanycKI3TG1IMr5bMJDajDKLlUQ==
dependencies:
"@types/node" "*"

"@types/estree@1.0.5", "@types/estree@^1.0.0":
version "1.0.5"
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
Expand Down Expand Up @@ -2492,7 +2485,7 @@
dependencies:
argparse "^2.0.1"

JSONStream@^1.0.4, JSONStream@^1.3.5:
JSONStream@^1.0.4:
version "1.3.5"
resolved "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz"
integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==
Expand Down Expand Up @@ -3277,22 +3270,22 @@ conventional-changelog-angular@^5.0.12:
compare-func "^2.0.0"
q "^1.5.1"

conventional-changelog-angular@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz"
integrity sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==
conventional-changelog-angular@^8.0.0:
version "8.0.0"
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-8.0.0.tgz#5701386850f0e0c2e630b43ee7821d322d87e7a6"
integrity sha512-CLf+zr6St0wIxos4bmaKHRXWAcsCXrJU6F4VdNDrGRK3B8LDLKoX3zuMV5GhtbGkVR/LohZ6MT6im43vZLSjmA==
dependencies:
compare-func "^2.0.0"

conventional-changelog-atom@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-4.0.0.tgz"
integrity sha512-q2YtiN7rnT1TGwPTwjjBSIPIzDJCRE+XAUahWxnh+buKK99Kks4WLMHoexw38GXx9OUxAsrp44f9qXe5VEMYhw==
conventional-changelog-atom@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-5.0.0.tgz#f3e06e06244bd0aef2e5f09ed590933d948e809c"
integrity sha512-WfzCaAvSCFPkznnLgLnfacRAzjgqjLUjvf3MftfsJzQdDICqkOOpcMtdJF3wTerxSpv2IAAjX8doM3Vozqle3g==

conventional-changelog-conventionalcommits@^7.0.2:
version "7.0.2"
resolved "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-7.0.2.tgz"
integrity sha512-NKXYmMR/Hr1DevQegFB4MwfM5Vv0m4UIxKZTTYuD98lpTknaZlSRrDOG4X7wIXpGkfsYxZTghUN+Qq+T0YQI7w==
conventional-changelog-conventionalcommits@^8.0.0:
version "8.0.0"
resolved "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-8.0.0.tgz#3fa2857c878701e7f0329db5a1257cb218f166fe"
integrity sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==
dependencies:
compare-func "^2.0.0"

Expand Down Expand Up @@ -3361,15 +3354,12 @@ conventional-commits-parser@^3.2.0:
split2 "^3.0.0"
through2 "^4.0.0"

conventional-commits-parser@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz"
integrity sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==
conventional-commits-parser@^6.0.0:
version "6.0.0"
resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.0.0.tgz#74e3be5344d8cd99f7c3353da2efa1d1dd618061"
integrity sha512-TbsINLp48XeMXR8EvGjTnKGsZqBemisPoyWESlpRyR8lif0lcwzqz+NMtYSj1ooF/WYjSuu7wX0CtdeeMEQAmA==
dependencies:
JSONStream "^1.3.5"
is-text-path "^2.0.0"
meow "^12.0.1"
split2 "^4.0.0"
meow "^13.0.0"

conventional-recommended-bump@^6.1.0:
version "6.1.0"
Expand Down Expand Up @@ -5162,13 +5152,6 @@ is-text-path@^1.0.1:
dependencies:
text-extensions "^1.0.0"

is-text-path@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz"
integrity sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==
dependencies:
text-extensions "^2.0.0"

is-typed-array@^1.1.10, is-typed-array@^1.1.12, is-typed-array@^1.1.9:
version "1.1.12"
resolved "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz"
Expand Down Expand Up @@ -5861,6 +5844,11 @@ meow@^12.0.1:
resolved "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz"
integrity sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==

meow@^13.0.0:
version "13.2.0"
resolved "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz#6b7d63f913f984063b3cc261b6e8800c4cd3474f"
integrity sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==

meow@^8.0.0:
version "8.1.2"
resolved "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz"
Expand Down Expand Up @@ -7774,11 +7762,6 @@ text-extensions@^1.0.0:
resolved "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz"
integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==

text-extensions@^2.0.0:
version "2.4.0"
resolved "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz"
integrity sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==

text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
Expand Down