Skip to content

Commit

Permalink
feat: add possibility to extend from string
Browse files Browse the repository at this point in the history
  • Loading branch information
dsemenchuk-modus committed Nov 21, 2019
1 parent 5fd8a69 commit 587f29a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions @commitlint/resolve-extends/src/index.ts
Expand Up @@ -13,7 +13,7 @@ export interface ResolvedConfig {

export interface ResolveExtendsConfig {
parserPreset?: unknown;
extends?: string[];
extends?: string | string[];
[key: string]: unknown;
}

Expand Down Expand Up @@ -48,7 +48,10 @@ function loadExtends(
config: ResolveExtendsConfig = {},
context: ResolveExtendsContext = {}
): ResolvedConfig[] {
return (config.extends || []).reduce<ResolvedConfig[]>((configs, raw) => {
const {extends: e} = config;
const ext = e ? (Array.isArray(e) ? e : [e]) : undefined;

return (ext || []).reduce<ResolvedConfig[]>((configs, raw) => {
const load = context.require || require;
const resolved = resolveConfig(raw, context);
const c = load(resolved);
Expand Down

0 comments on commit 587f29a

Please sign in to comment.