Skip to content

Commit

Permalink
Linting, ts types, general tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Dec 10, 2024
1 parent ab3ddb6 commit ec7994e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 154 deletions.
4 changes: 3 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
}
},
"files": {
"maxSize": 2097152
"maxSize": 2097152,
"ignoreUnknown": true,
"ignore": ["shims/*", "public/*"]
},
"json": {
"formatter": {
Expand Down
104 changes: 0 additions & 104 deletions examples/auth-basic.json5

This file was deleted.

9 changes: 0 additions & 9 deletions examples/basic-fork.json

This file was deleted.

9 changes: 0 additions & 9 deletions examples/simple.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/graph.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as d3 from "d3";
import type { EventID, MatrixEvent } from "./state_resolver";
import type { Scenario } from "./scenario";
import { textRepresentation } from "./event_list";
import type { Scenario } from "./scenario";
import type { EventID, MatrixEvent } from "./state_resolver";

export interface RenderOptions {
currentEventId: string;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ const setLoaderMessage = (text: string) => {
loaderMsgElement.innerText = text;
};

document.getElementById("resolve")!.addEventListener("click", async (ev) => {
document.getElementById("resolve")!.addEventListener("click", async (_) => {
if (!dag.shimUrl) {
console.error("you need to set a shim url to resolve state!");
return {};
Expand Down
2 changes: 1 addition & 1 deletion src/state_resolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe("StateResolver", () => {
const outstandingRequests: Array<{ id: string; data: DataResolveState }> = [];
const sr = new StateResolver(
{
sendResolveState: (id: string, data: DataResolveState) => {
sendResolveState: async (id: string, data: DataResolveState) => {
outstandingRequests.push({
id: id,
data: data,
Expand Down
10 changes: 5 additions & 5 deletions src/state_resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ interface DataGetEvent {

interface StateResolverReceiver {
onGetEventRequest(data: DataGetEvent): MatrixEvent;
onResolveStateResponse(id: string, data: DataResolveState);
onResolveStateResponse(id: string, data: DataResolveState): void;
}

interface StateResolverSender {
sendResolveState(id: string, data: DataResolveState);
sendResolveState(id: string, data: DataResolveState): Promise<void>;
}

interface ResolvedState {
state: Record<StateKeyTuple, EventID>;
}

class StateResolver implements StateResolverReceiver {
inflightRequests: Map<string, (DataResolveState) => void>;
inflightRequests: Map<string, (arg0: DataResolveState) => void>;
constructor(
readonly sender: StateResolverSender,
readonly getEvent: (data: DataGetEvent) => MatrixEvent,
Expand Down Expand Up @@ -160,8 +160,8 @@ class StateResolverTransport implements StateResolverSender {
this.ws.send(JSON.stringify(msg));
}

onWsClose(ev: CloseEvent) {}
onWsError(ev: Event) {}
onWsClose(_: CloseEvent) {}
onWsError(_: Event) {}
onWsMessage(ev: MessageEvent) {
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
const msg = JSON.parse(ev.data) as WebSocketMessage<any>;
Expand Down
Loading

0 comments on commit ec7994e

Please sign in to comment.