@commitlint/resolve-extends
Advanced tools
Comparing version 19.1.0 to 19.5.0
@@ -11,3 +11,3 @@ import type { ParserPreset, UserConfig } from '@commitlint/types'; | ||
*/ | ||
export declare const loadParserPreset: (resolvedParserPreset: string) => Promise<Pick<ParserPreset, 'path' | 'parserOpts'>>; | ||
export declare const loadParserPreset: (resolvedParserPreset: string) => Promise<Pick<ParserPreset, "path" | "parserOpts">>; | ||
export interface ResolveExtendsContext { | ||
@@ -14,0 +14,0 @@ cwd?: string; |
@@ -1,12 +0,1 @@ | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import fs from 'fs'; | ||
@@ -68,3 +57,3 @@ import path from 'path'; | ||
} | ||
catch (_a) { | ||
catch { | ||
throw resolveError; | ||
@@ -90,15 +79,12 @@ } | ||
extended.push(config); | ||
return extended.reduce((r, _a) => { | ||
var { extends: _ } = _a, c = __rest(_a, ["extends"]); | ||
return mergeWith(r, c, (objValue, srcValue, key) => { | ||
if (key === 'plugins') { | ||
if (Array.isArray(objValue)) { | ||
return objValue.concat(srcValue); | ||
} | ||
return extended.reduce((r, { extends: _, ...c }) => mergeWith(r, c, (objValue, srcValue, key) => { | ||
if (key === 'plugins') { | ||
if (Array.isArray(objValue)) { | ||
return objValue.concat(srcValue); | ||
} | ||
else if (Array.isArray(objValue)) { | ||
return srcValue; | ||
} | ||
}); | ||
}, e ? { extends: e } : {}); | ||
} | ||
else if (Array.isArray(objValue)) { | ||
return srcValue; | ||
} | ||
}), e ? { extends: e } : {}); | ||
} | ||
@@ -112,3 +98,3 @@ async function loadExtends(config = {}, context = {}) { | ||
const cwd = path.dirname(resolved); | ||
const ctx = Object.assign(Object.assign({}, context), { cwd }); | ||
const ctx = { ...context, cwd }; | ||
// Resolve parser preset if none was present before | ||
@@ -119,3 +105,6 @@ if (!context.parserPreset && | ||
const resolvedParserPreset = resolveFrom(c.parserPreset, cwd); | ||
const parserPreset = Object.assign({ name: c.parserPreset }, (await loadParserPreset(resolvedParserPreset))); | ||
const parserPreset = { | ||
name: c.parserPreset, | ||
...(await loadParserPreset(resolvedParserPreset)), | ||
}; | ||
ctx.parserPreset = parserPreset; | ||
@@ -170,3 +159,3 @@ config.parserPreset = parserPreset; | ||
} | ||
catch (_a) { } | ||
catch { } | ||
} | ||
@@ -184,5 +173,5 @@ /** | ||
} | ||
catch (_a) { } | ||
catch { } | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@commitlint/resolve-extends", | ||
"type": "module", | ||
"version": "19.1.0", | ||
"version": "19.5.0", | ||
"description": "Lint your commit messages", | ||
@@ -39,8 +39,8 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@commitlint/utils": "^19.0.0", | ||
"@commitlint/utils": "^19.5.0", | ||
"@types/lodash.mergewith": "^4.6.8" | ||
}, | ||
"dependencies": { | ||
"@commitlint/config-validator": "^19.0.3", | ||
"@commitlint/types": "^19.0.3", | ||
"@commitlint/config-validator": "^19.5.0", | ||
"@commitlint/types": "^19.5.0", | ||
"global-directory": "^4.0.1", | ||
@@ -51,3 +51,3 @@ "import-meta-resolve": "^4.0.0", | ||
}, | ||
"gitHead": "8d7a3d5d49ab77733e166cb5f195b1b7f277b4a7" | ||
"gitHead": "7e79af18b7500cda0e38f35944ee08b0b312c006" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16932
198