Skip to content

Commit 0bfac64

Browse files
committed
refactor config resolver to track logged configs per entry instead of per target to prevent duplicate logging
- Changed isFirstTimeLogging to isFirstTimeLoggingTarget to clarify it only controls chain hierarchy logging - Moved loggedConfigs.add() from after chain logging to inside merge loop after each config resolution - Changed merge loop logging condition from isFirstTimeLogging to !this.loggedConfigs.has(entry.path) - Ensures each config in chain is logged only once across all resolutions, not just
1 parent d608334 commit 0bfac64

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/cli/utils/config-resolver/config-resolver.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,12 @@ export class ConfigResolver {
130130
}
131131

132132
const targetPath = configChain[0]!.path;
133-
const isFirstTimeLogging = !this.loggedConfigs.has(targetPath);
133+
const isFirstTimeLoggingTarget = !this.loggedConfigs.has(targetPath);
134134

135-
// Log config chain hierarchy (only first time)
136-
if (this.debug && isFirstTimeLogging) {
135+
// Log config chain hierarchy (only first time for target)
136+
if (this.debug && isFirstTimeLoggingTarget) {
137137
const chainPaths = configChain.map((entry) => entry.path).join(' <- ');
138138
this.debug.log(`Config chain for ${targetPath} is: ${chainPaths}`);
139-
this.loggedConfigs.add(targetPath);
140139
}
141140

142141
// Start with base config
@@ -147,9 +146,10 @@ export class ConfigResolver {
147146
const entry = configChain[i]!;
148147
merged = deepMerge(merged, entry.config) as LinterConfig;
149148

150-
// Log result (only first time)
151-
if (this.debug && isFirstTimeLogging) {
149+
// Log result (only first time for each config)
150+
if (this.debug && !this.loggedConfigs.has(entry.path)) {
152151
this.debug.log(`Resolved config for ${entry.path}: ${ConfigResolver.formatConfigJson(merged)}`);
152+
this.loggedConfigs.add(entry.path);
153153
}
154154
}
155155

0 commit comments

Comments
 (0)