From 871128078163dbddb2fb2aa1d87ff019fa209386 Mon Sep 17 00:00:00 2001 From: Tiago Silva Date: Mon, 6 Oct 2025 11:06:45 -0300 Subject: [PATCH 1/2] Configure lint rules --- eslint.config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index 7b73cc355..c707ee03e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -41,7 +41,7 @@ export default [ // Disable rules that would fail. The failures should be fixed, and the entries here removed. "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-expressions": "off", - "@typescript-eslint/no-unused-vars": "off", + "no-unused-vars": "off", }, }, { @@ -50,6 +50,13 @@ export default [ "@typescript-eslint/prefer-nullish-coalescing": "error", eqeqeq: "error", "no-case-declarations": "error", + "@typescript-eslint/no-unused-vars": [ + "error", + { + args: "none", + caughtErrors: "none", + }, + ], }, }, ]; From 54c62f43144179c561f8581864a4cfa26cc1b51d Mon Sep 17 00:00:00 2001 From: Tiago Silva Date: Mon, 6 Oct 2025 11:07:30 -0300 Subject: [PATCH 2/2] Apply new lint rules --- src/client/components/Difficulties.ts | 1 + src/client/graphics/fx/SpriteFx.ts | 1 - src/client/graphics/layers/RadialMenuElements.ts | 8 ++++++++ src/client/graphics/layers/RailroadLayer.ts | 3 +++ src/client/graphics/layers/StructureLayer.ts | 1 + src/client/graphics/layers/TerritoryLayer.ts | 2 ++ src/core/Schemas.ts | 2 -- src/core/configuration/DevConfig.ts | 1 + src/core/game/TeamAssignment.ts | 1 + src/core/game/TerrainSearchMap.ts | 2 -- src/server/Master.ts | 3 +-- src/server/jwt.ts | 2 +- tests/ShellRandom.test.ts | 12 ------------ tests/core/executions/SAMLauncherExecution.test.ts | 1 + 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/client/components/Difficulties.ts b/src/client/components/Difficulties.ts index 914c2e90e..aeafdd49d 100644 --- a/src/client/components/Difficulties.ts +++ b/src/client/components/Difficulties.ts @@ -74,6 +74,7 @@ export class DifficultyDisplay extends LitElement { > `; + // eslint-disable-next-line @typescript-eslint/no-unused-vars const kingSkull = html`; export type PlayerPattern = z.infer; export type Flag = z.infer; export type GameStartInfo = z.infer; -const PlayerTypeSchema = z.enum(PlayerType); export interface GameInfo { gameID: GameID; diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index d530795c5..50336bc58 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -65,6 +65,7 @@ export class DevConfig extends DefaultConfig { unitInfo(type: UnitType): UnitInfo { const info = super.unitInfo(type); + // eslint-disable-next-line @typescript-eslint/no-unused-vars const oldCost = info.cost; // info.cost = (p: Player) => oldCost(p) / 1000000000; return info; diff --git a/src/core/game/TeamAssignment.ts b/src/core/game/TeamAssignment.ts index 1ec1bb566..535626d7d 100644 --- a/src/core/game/TeamAssignment.ts +++ b/src/core/game/TeamAssignment.ts @@ -33,6 +33,7 @@ export function assignTeams( ); // First, assign clan players + // eslint-disable-next-line @typescript-eslint/no-unused-vars for (const [_, clanPlayers] of sortedClans) { // Try to keep the clan together on the team with fewer players let team: Team | null = null; diff --git a/src/core/game/TerrainSearchMap.ts b/src/core/game/TerrainSearchMap.ts index bbcfe420a..c7366f38d 100644 --- a/src/core/game/TerrainSearchMap.ts +++ b/src/core/game/TerrainSearchMap.ts @@ -18,8 +18,6 @@ export class TerrainSearchMap { node(x: number, y: number): SearchMapTileType { const packedByte = this.mapData[4 + y * this.width + x]; const isLand = packedByte & 0b10000000; - const shoreline = !!(packedByte & 0b01000000); - const ocean = !!(packedByte & 0b00100000); const magnitude = packedByte & 0b00011111; if (isLand) { return SearchMapTileType.Land; diff --git a/src/server/Master.ts b/src/server/Master.ts index 993a4cec5..d662459df 100644 --- a/src/server/Master.ts +++ b/src/server/Master.ts @@ -285,14 +285,13 @@ async function schedulePublicGame(playlist: MapPlaylist) { if (!response.ok) { throw new Error(`Failed to schedule public game: ${response.statusText}`); } - - const data = await response.json(); } catch (error) { log.error(`Failed to schedule public game on worker ${workerPath}:`, error); throw error; } } +// eslint-disable-next-line @typescript-eslint/no-unused-vars function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } diff --git a/src/server/jwt.ts b/src/server/jwt.ts index d8a74384f..b0a81dc8b 100644 --- a/src/server/jwt.ts +++ b/src/server/jwt.ts @@ -27,7 +27,7 @@ export async function verifyClientToken( const issuer = config.jwtIssuer(); const audience = config.jwtAudience(); const key = await config.jwkPublicKey(); - const { payload, protectedHeader } = await jwtVerify(token, key, { + const { payload } = await jwtVerify(token, key, { algorithms: ["EdDSA"], issuer, audience, diff --git a/tests/ShellRandom.test.ts b/tests/ShellRandom.test.ts index 5c5590383..7466087ad 100644 --- a/tests/ShellRandom.test.ts +++ b/tests/ShellRandom.test.ts @@ -85,7 +85,6 @@ describe("Shell Random Damage", () => { expect(damage).toBeLessThanOrEqual(maxExpectedDamage); }); - const uniqueDamages = new Set(damages); expect(damages.length).toBeGreaterThan(0); }); @@ -231,16 +230,6 @@ describe("Shell Random Damage", () => { expect(damages.length).toBeGreaterThan(0); - const baseDamage = game.config().unitInfo(UnitType.Shell).damage ?? 250; - const expectedDamages = [ - Math.round((baseDamage / 250) * 200), - Math.round((baseDamage / 250) * 225), - Math.round((baseDamage / 250) * 250), - Math.round((baseDamage / 250) * 275), - Math.round((baseDamage / 250) * 300), - Math.round((baseDamage / 250) * 325), - ]; - const uniqueDamages = new Set(damages); expect(uniqueDamages.size).toBeGreaterThan(0); @@ -265,7 +254,6 @@ describe("Shell Random Damage", () => { ); const initialHealth = target.health(); - const seed = 12345; const shell1 = new ShellExecution( game.ref(coastX, 10), player1, diff --git a/tests/core/executions/SAMLauncherExecution.test.ts b/tests/core/executions/SAMLauncherExecution.test.ts index 0e7fc0d98..ed7ba534b 100644 --- a/tests/core/executions/SAMLauncherExecution.test.ts +++ b/tests/core/executions/SAMLauncherExecution.test.ts @@ -83,6 +83,7 @@ describe("SAM", () => { game.addExecution(new SAMLauncherExecution(defender, null, sam)); // Sam will only target nukes it can destroy before it reaches its target + // eslint-disable-next-line @typescript-eslint/no-unused-vars const nuke = attacker.buildUnit(UnitType.AtomBomb, game.ref(1, 1), { targetTile: game.ref(3, 1), trajectory: [