Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh committed Nov 21, 2024
1 parent ffc888e commit f1b4d87
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/workers/repository/init/inherited.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function mergeInheritedConfig(
'Found warnings in inherited configuration.',
);
}
const filteredConfig = removeGlobalConfig(inheritedConfig, true);
let filteredConfig = removeGlobalConfig(inheritedConfig, true);
if (!dequal(inheritedConfig, filteredConfig)) {
logger.debug(
{ inheritedConfig, filteredConfig },
Expand All @@ -105,11 +105,9 @@ export async function mergeInheritedConfig(
return mergeChildConfig(config, filteredConfig);
}

let returnConfig = filteredConfig;

logger.debug('Resolving presets found in inherited config');
const resolvedConfig = await resolveConfigPresets(
returnConfig,
filteredConfig,
config,
config.ignorePresets,
);
Expand All @@ -130,13 +128,14 @@ export async function mergeInheritedConfig(
);
}

returnConfig = removeGlobalConfig(resolvedConfig, true);
if (!dequal(resolvedConfig, returnConfig)) {
// remove global config options once again, as resolved presets could have added some
filteredConfig = removeGlobalConfig(resolvedConfig, true);
if (!dequal(resolvedConfig, filteredConfig)) {
logger.debug(
{ inheritedConfig: resolvedConfig, filteredConfig: returnConfig },
{ inheritedConfig: resolvedConfig, filteredConfig },
'Removed global config from inherited config presets.',
);
}

return mergeChildConfig(config, returnConfig);
return mergeChildConfig(config, filteredConfig);
}

0 comments on commit f1b4d87

Please sign in to comment.