Skip to content

Commit

Permalink
Consider location when checking warning uniqueness
Browse files Browse the repository at this point in the history
Resolves #1981.
  • Loading branch information
Gerrit0 committed Jul 6, 2022
1 parent 9750e2e commit fdd8238
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/lib/utils/loggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ export class Logger {
warn(text: string, node?: ts.Node): void;
warn(text: string, pos: number, file: MinimalSourceFile): void;
warn(text: string, ...args: FormatArgs): void {
if (this.seenWarnings.has(text)) return;
this.seenWarnings.add(text);
this.log(this.addContext(text, LogLevel.Warn, ...args), LogLevel.Warn);
const text2 = this.addContext(text, LogLevel.Warn, ...args);
if (this.seenWarnings.has(text2)) return;
this.seenWarnings.add(text2);
this.log(text2, LogLevel.Warn);
}

/**
Expand All @@ -133,12 +134,10 @@ export class Logger {
error(text: string, node?: ts.Node): void;
error(text: string, pos: number, file: MinimalSourceFile): void;
error(text: string, ...args: FormatArgs) {
if (this.seenErrors.has(text)) return;
this.seenErrors.add(text);
this.log(
this.addContext(text, LogLevel.Error, ...args),
LogLevel.Error
);
const text2 = this.addContext(text, LogLevel.Error, ...args);
if (this.seenErrors.has(text2)) return;
this.seenErrors.add(text2);
this.log(text2, LogLevel.Error);
}

/** @internal */
Expand Down

0 comments on commit fdd8238

Please sign in to comment.