diff --git a/lib/config.js b/lib/config.js index 3c91217d..e7724725 100644 --- a/lib/config.js +++ b/lib/config.js @@ -25,7 +25,15 @@ export function getMergedConfig(dir, home, additional) { const globalConfig = getConfig(GLOBAL_CONFIG, home); const projectConfig = getConfig(PROJECT_CONFIG, dir); const localConfig = getConfig(LOCAL_CONFIG, dir); - mergedConfig = Object.assign(globalConfig, projectConfig, localConfig, additional); + + // Using property descriptors to avoid calling any setter if e.g. a + // localConfig value overrides a globalConfig key. + mergedConfig = Object.create(null, { + ...Object.getOwnPropertyDescriptors(globalConfig), + ...Object.getOwnPropertyDescriptors(projectConfig), + ...Object.getOwnPropertyDescriptors(localConfig), + ...(additional && Object.getOwnPropertyDescriptors(additional)), + }); } return mergedConfig; };