Preserve detector extension mappings

Keep unmanaged detector fields when ignore-file updates the canonical detector configuration. Add a regression covering existing extension mappings.\n\nAI assistance: Codex implemented and validated this change under maintainer authorization.
This commit is contained in:
Paul Bakaus
2026-08-03 10:42:07 -07:00
parent 57ce11288f
commit 2345868c7b
2 changed files with 12 additions and 2 deletions
+6 -2
View File
@@ -240,10 +240,14 @@ function writeDetectorConfig(cwd, detectorConfig, opts = {}) {
const existingRaw = readRawConfigFile(filePath).raw;
const existing = existingRaw && typeof existingRaw === 'object' && !Array.isArray(existingRaw) ? existingRaw : {};
const nextHook = stripDetectorKeys(hookSection(existing));
const existingDetector = mergeDetectorConfig(detectorSection(existing));
const existingDetectorSection = detectorSection(existing) || {};
const existingDetector = mergeDetectorConfig(existingDetectorSection);
const next = {
...existing,
detector: mergeDetectorConfig(detectorConfig, existingDetector),
detector: {
...existingDetectorSection,
...mergeDetectorConfig(detectorConfig, existingDetector),
},
};
if (Object.keys(nextHook).length > 0) next.hook = nextHook;
else delete next.hook;