From 1115e989ce7d639ab51e448fa52c5c21632b6dea Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Thu, 9 Jan 2025 19:01:36 +0000 Subject: [PATCH] last bit of lint --- package.json | 1 + src/entities/playable/remoteWorm.ts | 2 +- src/frontend/components/app.tsx | 1 - src/frontend/components/ingame-view.tsx | 2 +- src/frontend/components/menu.tsx | 3 +- src/frontend/components/menus/lobby.tsx | 23 ++--- src/frontend/components/menus/online-play.tsx | 2 + src/frontend/components/menus/team-editor.tsx | 7 +- src/levels/scenarioParser.ts | 7 ++ src/logic/gamestate.ts | 3 +- src/net/client.ts | 81 ++++++++++++------ src/net/models.ts | 13 ++- src/scenarios/grenadeIsland.ts | 6 ++ src/scenarios/netGame.ts | 85 +++++++++++-------- src/scenarios/replayTesting.ts | 3 + src/scenarios/tiledMap.ts | 5 +- src/scenarios/uiTest.ts | 3 + src/state/model.ts | 1 - src/state/player.ts | 9 +- src/weapons/schema.ts | 14 +-- 20 files changed, 160 insertions(+), 111 deletions(-) diff --git a/package.json b/package.json index 1944e38..962d52c 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "tsc && vite build", "preview": "vite preview", "lint:eslint": "eslint src/", + "lint:eslint-fix": "eslint --fix src/", "test": "jest", "assets": "node scripts/generateAssetManifest.mjs > src/assets/manifest.ts", "lint:prettier": "prettier 'src/**/*.(ts|tsx|md)' '*.md' -c", diff --git a/src/entities/playable/remoteWorm.ts b/src/entities/playable/remoteWorm.ts index 8994ade..ffcf660 100644 --- a/src/entities/playable/remoteWorm.ts +++ b/src/entities/playable/remoteWorm.ts @@ -7,7 +7,7 @@ import { FireFn, Worm } from "./worm"; import { StateWormAction } from "../../state/model"; import Logger from "../../log"; import { InnerWormState } from "./wormState"; -import Controller, { InputKind } from "../../input"; +import { InputKind } from "../../input"; const logger = new Logger("RemoteWorm"); diff --git a/src/frontend/components/app.tsx b/src/frontend/components/app.tsx index 31f0b3b..4fac40b 100644 --- a/src/frontend/components/app.tsx +++ b/src/frontend/components/app.tsx @@ -5,7 +5,6 @@ import { assetLoadPercentage, assetsAreReady } from "../../assets"; import { NetClientConfig, NetGameClient, - NetGameInstance, RunningNetGameInstance, } from "../../net/client"; import { GameReactChannel } from "../../interop/gamechannel"; diff --git a/src/frontend/components/ingame-view.tsx b/src/frontend/components/ingame-view.tsx index 3bf1d67..7335cbd 100644 --- a/src/frontend/components/ingame-view.tsx +++ b/src/frontend/components/ingame-view.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from "preact/hooks"; import styles from "./ingame-view.module.css"; import { Game } from "../../game"; -import { NetGameInstance, RunningNetGameInstance } from "../../net/client"; +import { RunningNetGameInstance } from "../../net/client"; import { AmmoCount, GameReactChannel } from "../../interop/gamechannel"; import { WeaponSelector } from "./gameui/weapon-select"; diff --git a/src/frontend/components/menu.tsx b/src/frontend/components/menu.tsx index ec7acfb..45515aa 100644 --- a/src/frontend/components/menu.tsx +++ b/src/frontend/components/menu.tsx @@ -4,7 +4,6 @@ import styles from "./menu.module.css"; import { NetClientConfig, NetGameClient, - NetGameInstance, RunningNetGameInstance, } from "../../net/client"; import { GameMenu } from "./menus/types"; @@ -147,7 +146,7 @@ export function Menu({ return ( Team Editor - + ); } else if (currentMenu === GameMenu.Settings) { diff --git a/src/frontend/components/menus/lobby.tsx b/src/frontend/components/menus/lobby.tsx index 90b63c3..4c4efa9 100644 --- a/src/frontend/components/menus/lobby.tsx +++ b/src/frontend/components/menus/lobby.tsx @@ -79,7 +79,13 @@ export function ActiveLobby({ const [error, setError] = useState(); const membersMap = useObservableEagerState(gameInstance.members); - const members = useMemo(() => Object.entries(membersMap).sort(([uA], [uB]) => [uA, uB].sort().indexOf(uA)), [membersMap]); + const members = useMemo( + () => + Object.entries(membersMap).sort(([uA], [uB]) => + [uA, uB].sort().indexOf(uA), + ), + [membersMap], + ); const proposedTeams = useObservableEagerState(gameInstance.proposedTeams); const [storedLocalTeams] = useLocalStorageState( WORMGINE_STORAGE_KEY_TEAMS, @@ -115,8 +121,8 @@ export function ActiveLobby({ const viableToStart = true; - // const viableToStart = useMemo(() => - // gameInstance.isHost && members.length >= 2 && proposedTeams.length >= 2 && + // const viableToStart = useMemo(() => + // gameInstance.isHost && members.length >= 2 && proposedTeams.length >= 2 && // proposedTeams.reduce>>((v, o) => ({ // ...v, // [o.group]: (v[o.group] ?? 0) + 1 @@ -182,7 +188,8 @@ export function ActiveLobby({ } const onRemoveTeam = () => removeTeam(t); const incrementWormCount = () => { - const newWormCount = t.wormCount >= MAX_WORMS ? 1 : t.wormCount + 1; + const newWormCount = + t.wormCount >= MAX_WORMS ? 1 : t.wormCount + 1; gameInstance.addProposedTeam(t, newWormCount, t.group); }; const changeTeamColor = () => { @@ -216,10 +223,7 @@ export function ActiveLobby({
-