From 1c6af3bbe7bf16a819b39c5e999f5b3859a7f97e Mon Sep 17 00:00:00 2001 From: Vitaliy Stoliarov Date: Thu, 22 Aug 2024 23:13:36 +0300 Subject: [PATCH] fix: ts plugin prior diagnostics --- packages/plugin/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 41533f2..da03f9d 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -9,8 +9,9 @@ function init(modules: { typescript: typeof tsserverlibrary }) { ...info.languageService, getSemanticDiagnostics(fileName) { const config: { jsEnable: boolean } = info.config + const prior = info.languageService.getSemanticDiagnostics(fileName); if (!config?.jsEnable && (fileName.endsWith('.js') || fileName.endsWith('.jsx'))) { - return [] + return [...prior] } const result = lintSync( info.project.getCompilerOptions(), @@ -22,7 +23,7 @@ function init(modules: { typescript: typeof tsserverlibrary }) { }, ) oldProgram = result.program - const diagnostics: tsserverlibrary.Diagnostic[] = [] + const diagnostics: tsserverlibrary.Diagnostic[] = [...prior] for (const anyObject of result.anys) { let messageText: string if (anyObject.kind === FileAnyInfoKind.containsAny) {