Skip to content

Commit

Permalink
don't baaseline unreachable/unused/deprecated diagnostic levels as th…
Browse files Browse the repository at this point in the history
…ey aren't errors
  • Loading branch information
DetachHead committed Aug 29, 2024
1 parent b08c31a commit 85487cf
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/pyright-internal/src/baseline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FileDiagnostics } from './common/diagnosticSink';
import { Range } from './common/textRange';
import { mkdirSync, readFileSync, writeFileSync } from 'fs';
import { Uri } from './common/uri/uri';
import { DiagnosticCategory } from './common/diagnostic';

interface BaselineFile {
files: {
Expand All @@ -28,10 +29,19 @@ export const diagnosticsToBaseline = (rootDir: Uri, filesWithDiagnostics: FileDi
baselineData.files[filePath] = [];
}
baselineData.files[filePath].push(
...fileWithDiagnostics.diagnostics.map((diagnostic) => ({
code: diagnostic.getRule() as DiagnosticRule | undefined,
range: diagnostic.range,
}))
...fileWithDiagnostics.diagnostics
.filter(
(diagnostic) =>
![
DiagnosticCategory.Deprecated,
DiagnosticCategory.UnreachableCode,
DiagnosticCategory.UnusedCode,
].includes(diagnostic.category)
)
.map((diagnostic) => ({
code: diagnostic.getRule() as DiagnosticRule | undefined,
range: diagnostic.range,
}))
);
}
return baselineData;
Expand Down

0 comments on commit 85487cf

Please sign in to comment.