<commit_before>import { merge } from 'lodash';
import importFile from 'import-file';
import { isAbsolute } from 'path';

export default function resolveConfig(options = {}) {
	const { config, configWalk } = options;
	const useFindUp = configWalk && !isAbsolute(config);

	if (config) {
		try {
			const configJSON = importFile(config, { useFindUp });
			return merge(options, configJSON);
		}
		catch (err) {}
	}
	return options;
}<commit_msg>make cli options precedence over config file options<commit_after>import { merge } from 'lodash';
import importFile from 'import-file';
import { isAbsolute } from 'path';

export default function resolveConfig(cliOptions = {}) {
	const { config: configFile, configWalk } = cliOptions;
	const useFindUp = configWalk && !isAbsolute(configFile);

	if (configFile) {
		try {
			const config = importFile(configFile, { useFindUp });
			return merge(config, cliOptions);
		}
		catch (err) {}
	}
	return cliOptions;
}
{'fraction_non_alphanumeric': 0.12277019937040923, 'fraction_numerical': 0.0, 'mean_word_length': 4.781818181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4482110', 'n_tokens_mistral': 307, 'n_tokens_neox': 288, 'n_words': 84}