Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createYargsConfigArguments() {
const simpleArgv = yargsParser(process.argv.slice(2), {envPrefix: 'LHCI'});
/** @type {[string, (path: string) => LHCI.YargsOptions]} */
const configOption = ['config', loadAndParseRcFile];
// If they're using the config option or opting out of auto-detection, use the config option.
if (simpleArgv.config || hasOptedOutOfRcDetection()) return configOption;
const rcFile = findRcFile();
// If they don't currently have an rc file, use the config option for awareness.
if (!rcFile) return configOption;
return [loadAndParseRcFile(rcFile)];
}