Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
{
Expand All @@ -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",
},
],
},
},
];
1 change: 1 addition & 0 deletions src/client/components/Difficulties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class DifficultyDisplay extends LitElement {
></path>
</svg>`;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const kingSkull = html`<svg
stroke="currentColor"
fill="currentColor"
Expand Down
1 change: 0 additions & 1 deletion src/client/graphics/fx/SpriteFx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export class SpriteFx implements Fx {

if (!this.animatedSprite.isActive() && !this.waitToTheEnd) return false;

const t = this.elapsedTime / this.duration;
this.animatedSprite.update(frameTime);
this.animatedSprite.draw(ctx, this.x, this.y);
return true;
Expand Down
8 changes: 8 additions & 0 deletions src/client/graphics/layers/RadialMenuElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export enum Slot {
Delete = "delete",
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const infoChatElement: MenuElement = {
id: "info_chat",
name: "chat",
Expand All @@ -123,6 +124,7 @@ const infoChatElement: MenuElement = {
})),
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const allyTargetElement: MenuElement = {
id: "ally_target",
name: "target",
Expand All @@ -138,6 +140,7 @@ const allyTargetElement: MenuElement = {
},
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const allyTradeElement: MenuElement = {
id: "ally_trade",
name: "trade",
Expand All @@ -153,6 +156,7 @@ const allyTradeElement: MenuElement = {
},
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const allyEmbargoElement: MenuElement = {
id: "ally_embargo",
name: "embargo",
Expand Down Expand Up @@ -204,6 +208,7 @@ const allyBreakElement: MenuElement = {
},
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const allyDonateGoldElement: MenuElement = {
id: "ally_donate_gold",
name: "donate gold",
Expand All @@ -217,6 +222,7 @@ const allyDonateGoldElement: MenuElement = {
},
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const allyDonateTroopsElement: MenuElement = {
id: "ally_donate_troops",
name: "donate troops",
Expand All @@ -230,6 +236,7 @@ const allyDonateTroopsElement: MenuElement = {
},
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const infoPlayerElement: MenuElement = {
id: "info_player",
name: "player",
Expand All @@ -241,6 +248,7 @@ const infoPlayerElement: MenuElement = {
},
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const infoEmojiElement: MenuElement = {
id: "info_emoji",
name: "emoji",
Expand Down
3 changes: 3 additions & 0 deletions src/client/graphics/layers/RailroadLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class RailroadLayer implements Layer {
this.canvas.width = this.game.width() * 2;
this.canvas.height = this.game.height() * 2;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [_, rail] of this.existingRailroads) {
this.paintRail(rail.tile);
}
Expand All @@ -111,7 +112,9 @@ export class RailroadLayer implements Layer {

private handleRailroadRendering(railUpdate: RailroadUpdate) {
for (const railRoad of railUpdate.railTiles) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const x = this.game.x(railRoad.tile);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const y = this.game.y(railRoad.tile);
if (railUpdate.isActive) {
this.paintRailroad(railRoad);
Expand Down
1 change: 1 addition & 0 deletions src/client/graphics/layers/StructureLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export class StructureLayer implements Layer {
) {
let color = unit.owner().borderColor();
if (unit.type() === UnitType.Construction) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
color = underConstructionColor;
}

Expand Down
2 changes: 2 additions & 0 deletions src/client/graphics/layers/TerritoryLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,14 @@ export class TerritoryLayer implements Layer {
return;
}
const owner = this.game.owner(tile) as PlayerView;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isHighlighted =
this.highlightedTerritory &&
this.highlightedTerritory.id() === owner.id();
const myPlayer = this.game.myPlayer();

if (this.game.isBorder(tile)) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const playerIsFocused = owner && this.game.focusedPlayer() === owner;
if (myPlayer) {
const alternativeColor = this.alternateViewColor(owner);
Expand Down
2 changes: 0 additions & 2 deletions src/core/Schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
GameMapType,
GameMode,
GameType,
PlayerType,
Quads,
Trios,
UnitType,
Expand Down Expand Up @@ -118,7 +117,6 @@ export type PlayerCosmeticRefs = z.infer<typeof PlayerCosmeticRefsSchema>;
export type PlayerPattern = z.infer<typeof PlayerPatternSchema>;
export type Flag = z.infer<typeof FlagSchema>;
export type GameStartInfo = z.infer<typeof GameStartInfoSchema>;
const PlayerTypeSchema = z.enum(PlayerType);

export interface GameInfo {
gameID: GameID;
Expand Down
1 change: 1 addition & 0 deletions src/core/configuration/DevConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/core/game/TeamAssignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/core/game/TerrainSearchMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/server/Master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 0 additions & 12 deletions tests/ShellRandom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe("Shell Random Damage", () => {
expect(damage).toBeLessThanOrEqual(maxExpectedDamage);
});

const uniqueDamages = new Set(damages);
expect(damages.length).toBeGreaterThan(0);
});

Expand Down Expand Up @@ -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);

Expand All @@ -265,7 +254,6 @@ describe("Shell Random Damage", () => {
);
const initialHealth = target.health();

const seed = 12345;
const shell1 = new ShellExecution(
game.ref(coastX, 10),
player1,
Expand Down
1 change: 1 addition & 0 deletions tests/core/executions/SAMLauncherExecution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
Loading