Skip to content

Commit

Permalink
qual(client): lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fauu committed Dec 24, 2022
1 parent 3d37384 commit 46a9e81
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/web/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export {};

declare global {
interface Window {
root: HTMLDivElement;
root: HTMLDivElement,
}
}
8 changes: 5 additions & 3 deletions src/web/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import {
ActionPalette, actionsInclude, availableActions as getAvailableActions, hiraganaToKatakana,
katakanaToHiragana, type Action, type ActionInvocation
} from "~/action";
import type {
CharacterCounter as BackendCharacterCounter, ChunkVariant, Command, Config, EventName, InMessage,
PlayerStatus, RecognizerStatus
} from "~/backend";
import {
Backend, BackendNotConnectedScreen, CharacterCounter as BackendCharacterCounter, ChunkVariant,
Command, Config, InMessage, parseBackendConstant, parseRecognizerStatus, PlayerStatus,
playerStatusGotConnected, RecognizerStatus, type EventName
Backend, BackendNotConnectedScreen, parseBackendConstant, parseRecognizerStatus, playerStatusGotConnected
} from "~/backend";
import {
ChunkCurrentTranslationSelectionParentClass, ChunkView, createChunksState, type Chunk
Expand Down
4 changes: 2 additions & 2 deletions src/web/backend/core/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type EventNotification =

export type EventName = EventNotification["name"];

type MouseEventNotificationData = { target: DOMEventTarget, relatedTarget?: DOMEventTarget }
type MouseEventNotificationData = { target: DOMEventTarget, relatedTarget?: DOMEventTarget };

export type DOMEventTarget = {
tagName: string,
Expand All @@ -32,5 +32,5 @@ export function makeMouseEventNotificationData(
return {
target: domEventTargetFromElement(browserEvent.target! as HTMLElement)!,
relatedTarget: domEventTargetFromElement(browserEvent.relatedTarget as HTMLElement)
}
};
}
2 changes: 1 addition & 1 deletion src/web/chunk/TextSelectionState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function createChunkTextSelectionState(

function length(): number {
const range = value()?.range;
return range ? (range[1] - range[0] + 1) : 0
return range ? (range[1] - range[0] + 1) : 0;
}

function isWholeTextSelected(): boolean {
Expand Down
8 changes: 4 additions & 4 deletions src/web/chunk/label/Label.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Accessor, createEffect, untrack } from "solid-js";
import { type Accessor, createEffect, untrack } from "solid-js";
import { css } from "solid-styled-components";

import { ChunkCharIdxAttrName, ChunkLabelId } from "~/dom";
Expand Down Expand Up @@ -37,7 +37,7 @@ export class ChunkLabel {

createEffect(() => {
this.#toggleRubyConcealing(concealRubies());
})
});

this.#selectionMarkers = new LabelSelectionMarkers(this.#rootEl);
}
Expand Down Expand Up @@ -174,7 +174,7 @@ export class ChunkLabel {
rubyCorrection =
charEl.offsetParent !== this.#rootEl
? this.#offsetRubyCorrection(charEl)
: { x: 0, y: 0 }
: { x: 0, y: 0 };
this.#selectionMarkers.showLeftMarkerAt(
charEl.offsetLeft + rubyCorrection.x,
charEl.offsetTop + rubyCorrection.y,
Expand All @@ -188,7 +188,7 @@ export class ChunkLabel {
rubyCorrection =
charEl.offsetParent !== this.#rootEl
? this.#offsetRubyCorrection(charEl)
: { x: 0, y: 0 }
: { x: 0, y: 0 };
}
this.#selectionMarkers.showRightMarkerAt(
charEl.offsetLeft + charEl.offsetWidth + rubyCorrection.x,
Expand Down
2 changes: 1 addition & 1 deletion src/web/common/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ export const toggleEventListener = <K extends keyof HTMLElementEventMap>(
) => {
on ? el.addEventListener(type, listener)
: el.removeEventListener(type, listener);
}
};

4 changes: 2 additions & 2 deletions src/web/directives/concealUnlessHovered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ConcealUnlessHoveredParams = {
// ROBUSTNESS: Conceal is mistakenly triggered when mouse moves into a browser dropdown (at least
// on Firefox)
export function concealUnlessHovered(el: HTMLElement, value: () => ConcealUnlessHoveredParams) {
let { enabled } = value();
const { enabled } = value();

let coverEl: HTMLElement | undefined;

Expand All @@ -19,7 +19,7 @@ export function concealUnlessHovered(el: HTMLElement, value: () => ConcealUnless
return;
}
toggleCoverVisibility(coverEl!, true);
}
};

const cleanup = () => {
if (coverEl) {
Expand Down
8 changes: 4 additions & 4 deletions src/web/eventNotifier.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Backend, EventName, makeMouseEventNotificationData } from "./backend";
import { type Backend, type EventName, makeMouseEventNotificationData } from "./backend";
import { toggleEventListener } from "./common";

export type EventNotifier = ReturnType<typeof createEventNotifier>;
Expand All @@ -8,7 +8,7 @@ interface CreateEventNotifierParams {
}

export function createEventNotifier({ backend }: CreateEventNotifierParams) {
let notifiersActive: Map<EventName, boolean> = new Map();
const notifiersActive: Map<EventName, boolean> = new Map();

const notify = backend.eventNotify.bind(backend);

Expand All @@ -31,7 +31,7 @@ export function createEventNotifier({ backend }: CreateEventNotifierParams) {
toggleNotificationListener(eventName, true);
}
}
}
};

const notifyTabMouseenter = (event: MouseEvent) =>
notify({ name: "tab-mouseenter", data: makeMouseEventNotificationData(event) });
Expand Down Expand Up @@ -63,7 +63,7 @@ export function createEventNotifier({ backend }: CreateEventNotifierParams) {
toggleEventListener(window.root, "mouseleave", notifyApprootMouseleave, on);
break;
}
}
};

return {
shouldNotify,
Expand Down

0 comments on commit 46a9e81

Please sign in to comment.