From 5e0576890fa7fd0b5b4c38e33c128a3c4a23ad8b Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Wed, 11 Dec 2024 11:13:48 +0100 Subject: [PATCH] fix: suppress `[svelte] reactive_declaration_non_reactive_property` warnings during development --- src/lib/components/controls/SearchBox.svelte | 2 ++ src/lib/components/modes/JSONEditorRoot.svelte | 2 ++ src/lib/components/modes/textmode/TextMode.svelte | 2 ++ .../modes/textmode/menu/TextMenu.svelte | 2 ++ src/lib/components/modes/treemode/JSONNode.svelte | 2 ++ src/lib/components/modes/treemode/TreeMode.svelte | 15 ++++++++++----- .../modes/treemode/menu/TreeMenu.svelte | 2 ++ 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/lib/components/controls/SearchBox.svelte b/src/lib/components/controls/SearchBox.svelte index 853ee376..4acb4699 100644 --- a/src/lib/components/controls/SearchBox.svelte +++ b/src/lib/components/controls/SearchBox.svelte @@ -54,6 +54,8 @@ $: onSearch(searchResult) + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: applyChangedShowSearch(showSearch) const applyChangedSearchTextDebounced = debounce(applyChangedSearchText, DEBOUNCE_DELAY) diff --git a/src/lib/components/modes/JSONEditorRoot.svelte b/src/lib/components/modes/JSONEditorRoot.svelte index 6b01c227..7a707e25 100644 --- a/src/lib/components/modes/JSONEditorRoot.svelte +++ b/src/lib/components/modes/JSONEditorRoot.svelte @@ -112,6 +112,8 @@ mode = externalMode } + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: applyExternalMode(externalMode) function handleUndo(item: HistoryItem | undefined) { diff --git a/src/lib/components/modes/textmode/TextMode.svelte b/src/lib/components/modes/textmode/TextMode.svelte index 141cf320..18b3e8e6 100644 --- a/src/lib/components/modes/textmode/TextMode.svelte +++ b/src/lib/components/modes/textmode/TextMode.svelte @@ -223,6 +223,8 @@ escapeUnicodeCharacters }) + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: setCodeMirrorContent(externalContent, false, false) $: applyExternalSelection(externalSelection) $: updateLinter(validator) diff --git a/src/lib/components/modes/textmode/menu/TextMenu.svelte b/src/lib/components/modes/textmode/menu/TextMenu.svelte index 6eaa7249..f72137f0 100644 --- a/src/lib/components/modes/textmode/menu/TextMenu.svelte +++ b/src/lib/components/modes/textmode/menu/TextMenu.svelte @@ -105,6 +105,8 @@ } ] + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: items = onRenderMenu(defaultItems) || defaultItems diff --git a/src/lib/components/modes/treemode/JSONNode.svelte b/src/lib/components/modes/treemode/JSONNode.svelte index 6d37fe42..ad06c500 100644 --- a/src/lib/components/modes/treemode/JSONNode.svelte +++ b/src/lib/components/modes/treemode/JSONNode.svelte @@ -112,6 +112,8 @@ $: validationError = validationErrors?.validationError let isNodeSelected: boolean + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: isNodeSelected = pathInSelection(context.getJson(), selection, path) $: root = path.length === 0 diff --git a/src/lib/components/modes/treemode/TreeMode.svelte b/src/lib/components/modes/treemode/TreeMode.svelte index cbedf8af..f542fd77 100644 --- a/src/lib/components/modes/treemode/TreeMode.svelte +++ b/src/lib/components/modes/treemode/TreeMode.svelte @@ -266,6 +266,8 @@ } } + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: emitOnSelect(selection) let normalization: ValueNormalization @@ -281,6 +283,8 @@ let showSearch = false let showReplace = false + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: applySearchBoxSpacing(showSearch) function applySearchBoxSpacing(showSearch: boolean) { @@ -344,8 +348,12 @@ // two-way binding of externalContent and internal json and text ( // when receiving an updated prop, we have to update state for example + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: applyExternalContent(externalContent) + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: applyExternalSelection(externalSelection) let textIsRepaired = false @@ -353,6 +361,8 @@ let validationErrorList: ValidationError[] = [] let validationErrors: ValidationErrors | undefined + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: updateValidationErrors(json, validator, parser, validationParser) // because onChange returns the validation errors and there is also a separate listener, @@ -654,11 +664,6 @@ } } - // TODO: cleanup logging - // $: debug('json', json) - // $: debug('state', state) - // $: debug('selection', selection) - function handleEditKey() { if (readOnly || !selection) { return diff --git a/src/lib/components/modes/treemode/menu/TreeMenu.svelte b/src/lib/components/modes/treemode/menu/TreeMenu.svelte index 425e30d4..4070658a 100644 --- a/src/lib/components/modes/treemode/menu/TreeMenu.svelte +++ b/src/lib/components/modes/treemode/menu/TreeMenu.svelte @@ -157,6 +157,8 @@ } ] + // eslint-disable-next-line svelte/no-unused-svelte-ignore + // svelte-ignore reactive_declaration_non_reactive_property $: items = onRenderMenu(defaultItems) || defaultItems