From 0b6803c6c05aabb4cdf6ffbfc32f77877300847b Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 15 Sep 2026 14:16:34 -0700 Subject: [PATCH] fix(editor): don't flag an empty JSON editor as invalid --- apps/yaak-client/components/core/Editor/json-lint.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/yaak-client/components/core/Editor/json-lint.ts b/apps/yaak-client/components/core/Editor/json-lint.ts index a61ffc10..1a46bd25 100644 --- a/apps/yaak-client/components/core/Editor/json-lint.ts +++ b/apps/yaak-client/components/core/Editor/json-lint.ts @@ -32,6 +32,8 @@ interface JsonLintOptions { export function jsonParseLinter(options?: JsonLintOptions) { return (view: EditorView): Diagnostic[] => { const doc = view.state.doc.toString(); + if (doc.trim() === "") return []; + // We need lint to not break on stuff like {"foo:" ${[ ... ]}} so we'll replace all template // syntax with repeating `1` characters, so it's valid JSON and the position is still correct. const escapedDoc = doc.replace(TEMPLATE_SYNTAX_REGEX, (m) => "1".repeat(m.length));