diff --git a/packages/pyright-internal/src/baseline.ts b/packages/pyright-internal/src/baseline.ts index 890284d4a..94635ed86 100644 --- a/packages/pyright-internal/src/baseline.ts +++ b/packages/pyright-internal/src/baseline.ts @@ -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: { @@ -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;