From 83845d6219f4f1318b6705b3f946d4dbf6e9f15e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 9 Oct 2024 15:03:44 +0200 Subject: [PATCH] fix(transform): filter empty issues and keep stack trace --- src/transform.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/transform.ts b/src/transform.ts index 3e76624..5459bab 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -87,7 +87,9 @@ export async function transform( } const hasChanged = editor.hasChanged(); - const hasIssues = updates.some((u) => u.result.issues?.length); + const hasIssues = updates.some( + (u) => u.result.issues?.filter(Boolean).length, + ); const time = performance.now() - start; return { @@ -140,15 +142,14 @@ async function _transformBlock( result.issues = [ ...(result.issues || []), ...nestedRes.updates.flatMap((u) => u.result.issues || []), - ]; + ].filter(Boolean); } } return result; - } catch (_error: any) { - const error = `(${block.generator}) ${_error.message || _error}`; + } catch (error: any) { return { - contents: ``, + contents: ``, issues: [error], }; }