Clean up web code errors and make CI enforce them

This commit is contained in:
Keavon Chambers
2024-09-24 01:15:14 -07:00
parent 14de67c5a7
commit 1ee5ffbbe8
18 changed files with 44 additions and 129 deletions

View File

@@ -42,11 +42,8 @@
(e.target as HTMLElement | undefined)?.focus();
// Open the menu list floating menu
if (self) {
self.open = true;
} else {
throw new Error("The menu bar floating menu has no associated ref");
}
if (self) self.open = true;
else throw new Error("The menu bar floating menu has no reference to `self`");
}
</script>

View File

@@ -48,7 +48,7 @@
activeEntrySkipWatcher = false;
} else if (activeEntry !== DASH_ENTRY) {
// We need to set to the initial value first to track a right history step, as if we hover in initial selection.
dispatch("hoverInEntry", initialSelectedIndex);
if (initialSelectedIndex !== undefined) dispatch("hoverInEntry", initialSelectedIndex);
dispatch("selectedIndex", entries.flat().indexOf(activeEntry));
}
}
@@ -58,7 +58,7 @@
}
function dispatchHoverOutEntry() {
dispatch("hoverOutEntry", initialSelectedIndex);
if (initialSelectedIndex !== undefined) dispatch("hoverOutEntry", initialSelectedIndex);
}
function makeActiveEntry(): MenuListEntry {

View File

@@ -14,7 +14,7 @@
const pointerPosition = (direction: ScrollbarDirection, e: PointerEvent): number => (direction === "Vertical" ? e.clientY : e.clientX);
const dispatch = createEventDispatcher<{ handlePosition: number; pressTrack: number; pointerup }>();
const dispatch = createEventDispatcher<{ handlePosition: number; pressTrack: number; pointerup: undefined }>();
export let direction: ScrollbarDirection = "Vertical";
export let handlePosition = 0.5;