Enable the sort-imports eslint rule (#1849)

## Description:

Enable the `sort-imports` eslint rule.

Fixes #1784

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
This commit is contained in:
Scott Anderson
2025-08-17 20:53:44 -04:00
committed by GitHub
parent 62c08e25c2
commit 0a40bcebf0
180 changed files with 792 additions and 813 deletions
+4 -4
View File
@@ -1,4 +1,3 @@
import { renderTroops } from "../../client/Utils";
import {
Attack,
Execution,
@@ -7,12 +6,13 @@ import {
Player,
PlayerID,
PlayerType,
TerrainType,
TerraNullius,
TerrainType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { PseudoRandom } from "../PseudoRandom";
import { FlatBinaryHeap } from "./utils/FlatBinaryHeap"; // adjust path if needed
import { PseudoRandom } from "../PseudoRandom";
import { TileRef } from "../game/GameMap";
import { renderTroops } from "../../client/Utils";
const malusForRetreat = 25;
export class AttackExecution implements Execution {
+1 -1
View File
@@ -1,7 +1,7 @@
import { Execution, Game, Player } from "../game/Game";
import { BotBehavior } from "./utils/BotBehavior";
import { PseudoRandom } from "../PseudoRandom";
import { simpleHash } from "../Util";
import { BotBehavior } from "./utils/BotBehavior";
export class BotExecution implements Execution {
private active = true;
+6 -6
View File
@@ -1,10 +1,10 @@
import { Game, PlayerInfo, PlayerType } from "../game/Game";
import { TileRef } from "../game/GameMap";
import { PseudoRandom } from "../PseudoRandom";
import { GameID } from "../Schemas";
import { simpleHash } from "../Util";
import { SpawnExecution } from "./SpawnExecution";
import { BOT_NAME_PREFIXES, BOT_NAME_SUFFIXES } from "./utils/BotNames";
import { Game, PlayerInfo, PlayerType } from "../game/Game";
import { GameID } from "../Schemas";
import { PseudoRandom } from "../PseudoRandom";
import { SpawnExecution } from "./SpawnExecution";
import { TileRef } from "../game/GameMap";
import { simpleHash } from "../Util";
export class BotSpawner {
private random: PseudoRandom;
+1 -1
View File
@@ -7,7 +7,6 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { CityExecution } from "./CityExecution";
import { DefensePostExecution } from "./DefensePostExecution";
import { FactoryExecution } from "./FactoryExecution";
@@ -16,6 +15,7 @@ import { MissileSiloExecution } from "./MissileSiloExecution";
import { NukeExecution } from "./NukeExecution";
import { PortExecution } from "./PortExecution";
import { SAMLauncherExecution } from "./SAMLauncherExecution";
import { TileRef } from "../game/GameMap";
import { WarshipExecution } from "./WarshipExecution";
export class ConstructionExecution implements Execution {
+1 -1
View File
@@ -1,6 +1,6 @@
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
import { TileRef } from "../game/GameMap";
import { ShellExecution } from "./ShellExecution";
import { TileRef } from "../game/GameMap";
export class DefensePostExecution implements Execution {
private mg: Game;
+4 -4
View File
@@ -1,14 +1,12 @@
import { Execution, Game } from "../game/Game";
import { PseudoRandom } from "../PseudoRandom";
import { ClientID, GameID, Intent, Turn } from "../Schemas";
import { simpleHash } from "../Util";
import { Execution, Game } from "../game/Game";
import { AllianceExtensionExecution } from "./alliance/AllianceExtensionExecution";
import { AllianceRequestExecution } from "./alliance/AllianceRequestExecution";
import { AllianceRequestReplyExecution } from "./alliance/AllianceRequestReplyExecution";
import { BreakAllianceExecution } from "./alliance/BreakAllianceExecution";
import { AttackExecution } from "./AttackExecution";
import { BoatRetreatExecution } from "./BoatRetreatExecution";
import { BotSpawner } from "./BotSpawner";
import { BreakAllianceExecution } from "./alliance/BreakAllianceExecution";
import { ConstructionExecution } from "./ConstructionExecution";
import { DeleteUnitExecution } from "./DeleteUnitExecution";
import { DonateGoldExecution } from "./DonateGoldExecution";
@@ -19,12 +17,14 @@ import { FakeHumanExecution } from "./FakeHumanExecution";
import { MarkDisconnectedExecution } from "./MarkDisconnectedExecution";
import { MoveWarshipExecution } from "./MoveWarshipExecution";
import { NoOpExecution } from "./NoOpExecution";
import { PseudoRandom } from "../PseudoRandom";
import { QuickChatExecution } from "./QuickChatExecution";
import { RetreatExecution } from "./RetreatExecution";
import { SpawnExecution } from "./SpawnExecution";
import { TargetPlayerExecution } from "./TargetPlayerExecution";
import { TransportShipExecution } from "./TransportShipExecution";
import { UpgradeStructureExecution } from "./UpgradeStructureExecution";
import { simpleHash } from "../Util";
export class Executor {
// private random = new PseudoRandom(999)
+4 -4
View File
@@ -14,17 +14,17 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { euclDistFN, manhattanDistFN, TileRef } from "../game/GameMap";
import { PseudoRandom } from "../PseudoRandom";
import { GameID } from "../Schemas";
import { TileRef, euclDistFN, manhattanDistFN } from "../game/GameMap";
import { calculateBoundingBox, flattenedEmojiTable, simpleHash } from "../Util";
import { BotBehavior } from "./utils/BotBehavior";
import { ConstructionExecution } from "./ConstructionExecution";
import { EmojiExecution } from "./EmojiExecution";
import { GameID } from "../Schemas";
import { NukeExecution } from "./NukeExecution";
import { PseudoRandom } from "../PseudoRandom";
import { SpawnExecution } from "./SpawnExecution";
import { TransportShipExecution } from "./TransportShipExecution";
import { closestTwoTiles } from "./Util";
import { BotBehavior } from "./utils/BotBehavior";
export class FakeHumanExecution implements Execution {
private active = true;
+2 -2
View File
@@ -7,11 +7,11 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { NukeExecution } from "./NukeExecution";
import { ParabolaPathFinder } from "../pathfinding/PathFinding";
import { PseudoRandom } from "../PseudoRandom";
import { TileRef } from "../game/GameMap";
import { simpleHash } from "../Util";
import { NukeExecution } from "./NukeExecution";
export class MirvExecution implements Execution {
private active = true;
+3 -3
View File
@@ -1,18 +1,18 @@
import {
Execution,
Game,
isStructureType,
MessageType,
Player,
TerraNullius,
TrajectoryTile,
Unit,
UnitType,
isStructureType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { NukeType } from "../StatsSchemas";
import { ParabolaPathFinder } from "../pathfinding/PathFinding";
import { PseudoRandom } from "../PseudoRandom";
import { NukeType } from "../StatsSchemas";
import { TileRef } from "../game/GameMap";
const SPRITE_RADIUS = 16;
+2 -2
View File
@@ -1,8 +1,8 @@
import { Config } from "../configuration/Config";
import { Execution, Game, Player, UnitType } from "../game/Game";
import { GameImpl } from "../game/GameImpl";
import { GameMap, TileRef } from "../game/GameMap";
import { calculateBoundingBox, getMode, inscribed, simpleHash } from "../Util";
import { Config } from "../configuration/Config";
import { GameImpl } from "../game/GameImpl";
export class PlayerExecution implements Execution {
private readonly ticksPerClusterCalc = 20;
+1 -1
View File
@@ -1,6 +1,6 @@
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
import { TileRef } from "../game/GameMap";
import { PseudoRandom } from "../PseudoRandom";
import { TileRef } from "../game/GameMap";
import { TradeShipExecution } from "./TradeShipExecution";
import { TrainStationExecution } from "./TrainStationExecution";
+1 -1
View File
@@ -1,7 +1,7 @@
import { Execution, Game } from "../game/Game";
import { TileRef } from "../game/GameMap";
import { GameUpdateType, RailTile, RailType } from "../game/GameUpdates";
import { Railroad } from "../game/Railroad";
import { TileRef } from "../game/GameMap";
export class RailroadExecution implements Execution {
private mg: Game;
+2 -2
View File
@@ -1,15 +1,15 @@
import {
Execution,
Game,
isUnit,
MessageType,
Player,
Unit,
UnitType,
isUnit,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { PseudoRandom } from "../PseudoRandom";
import { SAMMissileExecution } from "./SAMMissileExecution";
import { TileRef } from "../game/GameMap";
type Target = {
unit: Unit;
+2 -2
View File
@@ -6,10 +6,10 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { AirPathFinder } from "../pathfinding/PathFinding";
import { PseudoRandom } from "../PseudoRandom";
import { NukeType } from "../StatsSchemas";
import { PseudoRandom } from "../PseudoRandom";
import { TileRef } from "../game/GameMap";
export class SAMMissileExecution implements Execution {
private active = true;
+1 -1
View File
@@ -1,7 +1,7 @@
import { Execution, Game, Player, Unit, UnitType } from "../game/Game";
import { TileRef } from "../game/GameMap";
import { AirPathFinder } from "../pathfinding/PathFinding";
import { PseudoRandom } from "../PseudoRandom";
import { TileRef } from "../game/GameMap";
export class ShellExecution implements Execution {
private active = true;
+1 -1
View File
@@ -1,7 +1,7 @@
import { Execution, Game, Player, PlayerInfo, PlayerType } from "../game/Game";
import { TileRef } from "../game/GameMap";
import { BotExecution } from "./BotExecution";
import { PlayerExecution } from "./PlayerExecution";
import { TileRef } from "../game/GameMap";
import { getSpawnTiles } from "./Util";
export class SpawnExecution implements Execution {
+2 -2
View File
@@ -1,4 +1,3 @@
import { renderNumber } from "../../client/Utils";
import {
Execution,
Game,
@@ -7,10 +6,11 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { PathFindResultType } from "../pathfinding/AStar";
import { PathFinder } from "../pathfinding/PathFinding";
import { TileRef } from "../game/GameMap";
import { distSortUnit } from "../Util";
import { renderNumber } from "../../client/Utils";
export class TradeShipExecution implements Execution {
private active = true;
+2 -2
View File
@@ -6,9 +6,9 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { OrientedRailroad, getOrientedRailroad } from "../game/Railroad";
import { RailNetwork } from "../game/RailNetwork";
import { getOrientedRailroad, OrientedRailroad } from "../game/Railroad";
import { TileRef } from "../game/GameMap";
import { TrainStation } from "../game/TrainStation";
export class TrainExecution implements Execution {
+1 -1
View File
@@ -1,7 +1,7 @@
import { Execution, Game, Unit } from "../game/Game";
import { TrainStation } from "../game/TrainStation";
import { PseudoRandom } from "../PseudoRandom";
import { TrainExecution } from "./TrainExecution";
import { TrainStation } from "../game/TrainStation";
export class TrainStationExecution implements Execution {
private mg: Game;
+3 -3
View File
@@ -8,11 +8,11 @@ import {
Unit,
UnitType,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { targetTransportTile } from "../game/TransportShipUtils";
import { AttackExecution } from "./AttackExecution";
import { PathFindResultType } from "../pathfinding/AStar";
import { PathFinder } from "../pathfinding/PathFinding";
import { AttackExecution } from "./AttackExecution";
import { TileRef } from "../game/GameMap";
import { targetTransportTile } from "../game/TransportShipUtils";
export class TransportShipExecution implements Execution {
private lastMove: number;
+1 -1
View File
@@ -1,4 +1,4 @@
import { euclDistFN, GameMap, TileRef } from "../game/GameMap";
import { GameMap, TileRef, euclDistFN } from "../game/GameMap";
export function getSpawnTiles(gm: GameMap, tile: TileRef): TileRef[] {
return Array.from(gm.bfs(tile, euclDistFN(tile, 4, true))).filter(
+2 -2
View File
@@ -1,17 +1,17 @@
import {
Execution,
Game,
isUnit,
OwnerComp,
Unit,
UnitParams,
UnitType,
isUnit,
} from "../game/Game";
import { TileRef } from "../game/GameMap";
import { PathFindResultType } from "../pathfinding/AStar";
import { PathFinder } from "../pathfinding/PathFinding";
import { PseudoRandom } from "../PseudoRandom";
import { ShellExecution } from "./ShellExecution";
import { TileRef } from "../game/GameMap";
export class WarshipExecution implements Execution {
private random: PseudoRandom;
+1 -1
View File
@@ -1,4 +1,3 @@
import { GameEvent } from "../EventBus";
import {
ColoredTeams,
Execution,
@@ -7,6 +6,7 @@ import {
Player,
Team,
} from "../game/Game";
import { GameEvent } from "../EventBus";
export class WinEvent implements GameEvent {
constructor(public readonly winner: Player) {}
+2 -2
View File
@@ -7,11 +7,11 @@ import {
TerraNullius,
Tick,
} from "../../game/Game";
import { PseudoRandom } from "../../PseudoRandom";
import { flattenedEmojiTable } from "../../Util";
import { AllianceExtensionExecution } from "../alliance/AllianceExtensionExecution";
import { AttackExecution } from "../AttackExecution";
import { EmojiExecution } from "../EmojiExecution";
import { PseudoRandom } from "../../PseudoRandom";
import { flattenedEmojiTable } from "../../Util";
export class BotBehavior {
private enemy: Player | null = null;