How to use the @commitlint/resolve-extends function in @commitlint/resolve-extends

To help you get started, we’ve selected a few @commitlint/resolve-extends examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conventional-changelog / commitlint / @commitlint / load / src / index.ts View on Github external
// Merge passed config with file based options
	const preliminaryConfig = valid(
		merge({}, loaded ? loaded.config : null, seed)
	);
	const config = {
		...preliminaryConfig,
		parserPreset: await loadParserPreset(base, preliminaryConfig)
	};

	const opts = merge(
		{extends: [], rules: {}, formatter: '@commitlint/format'},
		pick(config, 'extends', 'plugins', 'ignores', 'defaultIgnores')
	);

	// Resolve extends key
	const extended = resolveExtends(opts, {
		prefix: 'commitlint-config',
		cwd: base,
		parserPreset: config.parserPreset
	});

	const preliminaryPreset = valid(mergeWith(extended, config, w));
	const preset = {
		...preliminaryPreset,
		parserPreset: await loadParserPreset(base, preliminaryPreset)
	};

	config.extends = Array.isArray(config.extends) ? config.extends : [];

	// Resolve config-relative formatter module
	if (typeof config.formatter === 'string') {
		preset.formatter =
github conventional-changelog / commitlint / @commitlint / load / src / index.js View on Github external
pick(config, 'extends', 'plugins', 'ignores', 'defaultIgnores')
	);

	// Resolve parserPreset key when overwritten by main config
	if (typeof config.parserPreset === 'string') {
		const resolvedParserPreset = resolveFrom(base, config.parserPreset);

		config.parserPreset = {
			name: config.parserPreset,
			path: resolvedParserPreset,
			parserOpts: require(resolvedParserPreset)
		};
	}

	// Resolve extends key
	const extended = resolveExtends(opts, {
		prefix: 'commitlint-config',
		cwd: base,
		parserPreset: config.parserPreset
	});

	const preset = valid(mergeWith(extended, config, w));

	// Resolve parser-opts from preset
	if (typeof preset.parserPreset === 'object') {
		preset.parserPreset.parserOpts = await loadParserOpts(
			preset.parserPreset.name,
			preset.parserPreset
		);
	}

	// Resolve config-relative formatter module
github conventional-changelog / commitlint / @commitlint / load / src / index.js View on Github external
let resolvedParserConfig = await require(resolvedParserPreset);

		// Resolve loaded parser preset factory
		if (typeof resolvedParserConfig === 'function') {
			resolvedParserConfig = await resolvedParserConfig();
		}

		config.parserPreset = {
			name: config.parserPreset,
			path: resolvedParserPreset,
			parserOpts: resolvedParserConfig.parserOpts
		};
	}

	// Resolve extends key
	const extended = resolveExtends(opts, {
		prefix: 'commitlint-config',
		cwd: base,
		parserPreset: config.parserPreset
	});

	const preset = valid(mergeWith(extended, config, w));
	// Await parser-preset if applicable
	if (
		typeof preset.parserPreset === 'object' &&
		typeof preset.parserPreset.parserOpts === 'object' &&
		typeof preset.parserPreset.parserOpts.then === 'function'
	) {
		let parserPreset = await preset.parserPreset.parserOpts;

		// Resolve loaded parser preset factory from extended config
		if (typeof parserPreset === 'function') {

@commitlint/resolve-extends

Lint your commit messages

MIT
Latest version published 2 months ago

Package Health Score

98 / 100
Full package analysis

Popular @commitlint/resolve-extends functions