Skip to content

Commit

Permalink
fix issue where an empty baseline file was being written automaticall…
Browse files Browse the repository at this point in the history
…y created when there wasn't one already
  • Loading branch information
DetachHead committed Sep 30, 2024
1 parent 0bc2989 commit e354d61
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/pyright-internal/src/pyright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,11 @@ const outputResults = (
!filteredDiagnostics.map((fileWithDiagnostics) => fileWithDiagnostics.diagnostics.length).reduce(add, 0)
) {
const previousBaseline = getBaselinedErrors(service.fs, rootDir);
const newBaseline = writeDiagnosticsToBaselineFile(service.fs, rootDir, results.diagnostics, false);
console.info(getBaselineSummaryMessage(rootDir, previousBaseline, newBaseline));
// don't write the baseline file if there wasn't one there already unless the user explicitly asked for it
if (args.writebaseline || Object.keys(previousBaseline.files).length) {
const newBaseline = writeDiagnosticsToBaselineFile(service.fs, rootDir, results.diagnostics, false);
console.info(getBaselineSummaryMessage(rootDir, previousBaseline, newBaseline));
}
}

const treatWarningsAsErrors = !!args.warnings;
Expand Down

0 comments on commit e354d61

Please sign in to comment.