Skip to content

Commit cc7373a

Browse files
committed
refactor(parse): add strict options interface
1 parent 8cd3051 commit cc7373a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

@commitlint/parse/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isArray, mergeWith} from 'lodash';
2-
import {Commit} from './types';
2+
import {Commit, ParserOptions} from './types';
33

44
const {sync} = require('conventional-commits-parser');
55
const defaultChangelogOpts = require('conventional-changelog-angular');
@@ -8,9 +8,9 @@ export default parse;
88
export * from './types';
99

1010
async function parse(
11-
message?: any,
11+
message?: string,
1212
parser: any = sync,
13-
parserOpts: any = undefined
13+
parserOpts?: ParserOptions
1414
): Promise<Commit> {
1515
const defaultOpts = (await defaultChangelogOpts).parserOpts;
1616
const parsed = parser(

@commitlint/parse/src/types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ export interface CommitReference {
2626
repository: string | null;
2727
issue: string | null;
2828
}
29+
30+
export interface ParserOptions {
31+
headerCorrespondence?: string[];
32+
headerPattern?: RegExp;
33+
mergeCorrespondence?: string[];
34+
mergePattern?: RegExp;
35+
noteKeywords?: string[];
36+
revertCorrespondence?: string[];
37+
revertPattern?: RegExp;
38+
}

0 commit comments

Comments
 (0)