Skip to content

Commit

Permalink
refactor(parse): add strict options interface
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Jul 29, 2019
1 parent 8cd3051 commit cc7373a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions @commitlint/parse/src/index.ts
@@ -1,5 +1,5 @@
import {isArray, mergeWith} from 'lodash';
import {Commit} from './types';
import {Commit, ParserOptions} from './types';

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

async function parse(
message?: any,
message?: string,
parser: any = sync,
parserOpts: any = undefined
parserOpts?: ParserOptions
): Promise<Commit> {
const defaultOpts = (await defaultChangelogOpts).parserOpts;
const parsed = parser(
Expand Down
10 changes: 10 additions & 0 deletions @commitlint/parse/src/types.ts
Expand Up @@ -26,3 +26,13 @@ export interface CommitReference {
repository: string | null;
issue: string | null;
}

export interface ParserOptions {
headerCorrespondence?: string[];
headerPattern?: RegExp;
mergeCorrespondence?: string[];
mergePattern?: RegExp;
noteKeywords?: string[];
revertCorrespondence?: string[];
revertPattern?: RegExp;
}

0 comments on commit cc7373a

Please sign in to comment.