Skip to content

Commit

Permalink
fix: newly generated errors by svelte compiler
Browse files Browse the repository at this point in the history
`CodeMirror.svelte` currently uses a lot of ignores to avoid svelte compiler warnings (but are reported as errors in eslint), and related components will be refactored in the future.
  • Loading branch information
ACTCD committed Sep 18, 2024
1 parent 8159a51 commit c819e3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dev/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
href="https://github.com/quoid/userscripts"
target="_blank"
rel="noreferrer"
aria-label="open userscripts github"
>
<img src={Logo} class="logo" alt="Logo" />
</a>
Expand Down
8 changes: 7 additions & 1 deletion src/ext/extension-page/Components/Editor/CodeMirror.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script context="module">
<script module>
// once initialized, references the codemirror instance
let instance;
// saved and session code vars are used to track unsaved changes
Expand Down Expand Up @@ -65,6 +65,7 @@
getAnnotations: linter,
};
// svelte-ignore reactive_declaration_module_script_dependency
// update settings when changed
$: if (instance) {
instance.setOption("autoCloseBrackets", $settings["editor_close_brackets"]);
Expand All @@ -76,11 +77,13 @@
);
}
// svelte-ignore reactive_declaration_module_script_dependency
// store cursor position and disable on save
$: if ($state.includes("saving")) {
cursor = instance.getCursor();
disable();
}
// svelte-ignore reactive_declaration_module_script_dependency
// re-enable after, focus and set cursor back save completes
$: if ($state.includes("ready") && state.getOldState().includes("saving")) {
enable();
Expand All @@ -92,18 +95,21 @@
$: if ($state.includes("trashing") || $state.includes("updating")) {
disable();
}
// svelte-ignore reactive_declaration_module_script_dependency
// reset saved and session code & re-enable after trashing completes
$: if ($state && state.getOldState().includes("trashing")) {
savedCode = null;
sessionCode = null;
enable();
}
// update session code and re-enable after updating completes
// svelte-ignore reactive_declaration_module_script_dependency
$: if ($state && state.getOldState().includes("updating")) {
sessionCode = instance.getValue();
enable();
}
// svelte-ignore reactive_declaration_module_script_dependency
// track lint settings and update accordingly
$: if (instance && $settings["editor_javascript_lint"]) {
toggleLint("enable");
Expand Down
1 change: 1 addition & 0 deletions src/ext/shared/Components/Toggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
aria-pressed={checked}
{disabled}
{title}
aria-label="toggle"
>
<span aria-hidden="true"></span>
</button>
Expand Down

0 comments on commit c819e3f

Please sign in to comment.