Enable eslint rule @stylistic/ts/indent (#1779)

## Description:

Enable eslint rule `@stylistic/ts/indent`. Fixes #1778

## 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-11 22:26:48 -04:00
committed by GitHub
parent ce49599229
commit a9e5aa0187
19 changed files with 257 additions and 200 deletions
+5 -5
View File
@@ -296,8 +296,8 @@ export class HostLobbyModal extends LitElement {
${typeof o === "string"
? translateText(`public_lobby.teams_${o}`)
: translateText("public_lobby.teams", {
num: o,
})}
num: o,
})}
</div>
</div>
`,
@@ -441,9 +441,9 @@ export class HostLobbyModal extends LitElement {
style="display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;"
>
${renderUnitTypeOptions({
disabledUnits: this.disabledUnits,
toggleUnit: this.toggleUnit.bind(this),
})}
disabledUnits: this.disabledUnits,
toggleUnit: this.toggleUnit.bind(this),
})}
</div>
</div>
</div>
+9 -9
View File
@@ -276,16 +276,16 @@ export class LangSelector extends LitElement {
this.languageList.find((l) => l.code === this.currentLang) ??
(this.currentLang === "debug"
? {
code: "debug",
native: "Debug",
en: "Debug",
svg: "xx",
}
code: "debug",
native: "Debug",
en: "Debug",
svg: "xx",
}
: {
native: "English",
en: "English",
svg: "uk_us_flag",
});
native: "English",
en: "English",
svg: "uk_us_flag",
});
return html`
<div class="container__row">
+2 -2
View File
@@ -156,8 +156,8 @@ export class PublicLobby extends LitElement {
? typeof teamCount === "string"
? translateText(`public_lobby.teams_${teamCount}`)
: translateText("public_lobby.teams", {
num: teamCount ?? 0,
})
num: teamCount ?? 0,
})
: translateText("game_mode.ffa")}</span
>
<span
+4 -4
View File
@@ -244,8 +244,8 @@ export class UserSettingModal extends LitElement {
<button
class="w-1/2 text-center px-3 py-1 rounded-l
${this.settingsMode === "basic"
? "bg-white/10 text-white"
: "bg-transparent text-gray-400"}"
? "bg-white/10 text-white"
: "bg-transparent text-gray-400"}"
@click=${() => (this.settingsMode = "basic")}
>
${translateText("user_setting.tab_basic")}
@@ -253,8 +253,8 @@ export class UserSettingModal extends LitElement {
<button
class="w-1/2 text-center px-3 py-1 rounded-r
${this.settingsMode === "keybinds"
? "bg-white/10 text-white"
: "bg-transparent text-gray-400"}"
? "bg-white/10 text-white"
: "bg-transparent text-gray-400"}"
@click=${() => (this.settingsMode = "keybinds")}
>
${translateText("user_setting.tab_keybinds")}
+36 -36
View File
@@ -529,8 +529,8 @@ export class EventsDisplay extends LitElement implements Layer {
traitorDuration === 1
? translateText("events_display.duration_second")
: translateText("events_display.duration_seconds_plural", {
seconds: traitorDuration,
});
seconds: traitorDuration,
});
this.addEvent({
description: translateText("events_display.betrayal_description", {
@@ -768,11 +768,11 @@ export class EventsDisplay extends LitElement implements Layer {
})}
${!attack.retreating
? this.renderButton({
content: "❌",
onClick: () => this.emitCancelAttackIntent(attack.id),
className: "text-left flex-shrink-0",
disabled: attack.retreating,
})
content: "❌",
onClick: () => this.emitCancelAttackIntent(attack.id),
className: "text-left flex-shrink-0",
disabled: attack.retreating,
})
: html`<span class="flex-shrink-0 text-blue-400"
>(${translateText(
"events_display.retreating",
@@ -803,12 +803,12 @@ export class EventsDisplay extends LitElement implements Layer {
})}
${!landAttack.retreating
? this.renderButton({
content: "❌",
onClick: () =>
this.emitCancelAttackIntent(landAttack.id),
className: "text-left flex-shrink-0",
disabled: landAttack.retreating,
})
content: "❌",
onClick: () =>
this.emitCancelAttackIntent(landAttack.id),
className: "text-left flex-shrink-0",
disabled: landAttack.retreating,
})
: html`<span class="flex-shrink-0 text-blue-400"
>(${translateText(
"events_display.retreating",
@@ -840,11 +840,11 @@ export class EventsDisplay extends LitElement implements Layer {
})}
${!boat.retreating()
? this.renderButton({
content: "❌",
onClick: () => this.emitBoatCancelIntent(boat.id()),
className: "text-left flex-shrink-0",
disabled: boat.retreating(),
})
content: "❌",
onClick: () => this.emitBoatCancelIntent(boat.id()),
className: "text-left flex-shrink-0",
disabled: boat.retreating(),
})
: html`<span class="flex-shrink-0 text-blue-400"
>(${translateText(
"events_display.retreating",
@@ -1033,24 +1033,24 @@ export class EventsDisplay extends LitElement implements Layer {
>
${event.focusID
? this.renderButton({
content: this.getEventDescription(event),
onClick: () => {
event.focusID &&
content: this.getEventDescription(event),
onClick: () => {
event.focusID &&
this.emitGoToPlayerEvent(event.focusID);
},
className: "text-left",
})
},
className: "text-left",
})
: event.unitView
? this.renderButton({
content: this.getEventDescription(event),
onClick: () => {
event.unitView &&
content: this.getEventDescription(event),
onClick: () => {
event.unitView &&
this.emitGoToUnitEvent(
event.unitView,
);
},
className: "text-left",
})
},
className: "text-left",
})
: this.getEventDescription(event)}
<!-- Events with buttons (Alliance requests) -->
${event.buttons
@@ -1061,12 +1061,12 @@ export class EventsDisplay extends LitElement implements Layer {
<button
class="inline-block px-3 py-1 text-white rounded text-md md:text-sm cursor-pointer transition-colors duration-300
${btn.className.includes("btn-info")
? "bg-blue-500 hover:bg-blue-600"
: btn.className.includes(
"btn-gray",
)
? "bg-gray-500 hover:bg-gray-600"
: "bg-green-600 hover:bg-green-700"}"
? "bg-blue-500 hover:bg-blue-600"
: btn.className.includes(
"btn-gray",
)
? "bg-gray-500 hover:bg-gray-600"
: "bg-green-600 hover:bg-green-700"}"
@click=${() => {
btn.action();
if (!btn.preventClose) {
+3 -3
View File
@@ -351,9 +351,9 @@ export class PlayerPanel extends LitElement implements Layer {
>
${other.allies().length > 0
? other
.allies()
.map((p) => p.name())
.join(", ")
.allies()
.map((p) => p.name())
.join(", ")
: translateText("player_panel.none")}
</div>
</div>
+2 -2
View File
@@ -374,8 +374,8 @@ export class SettingsModal extends LitElement implements Layer {
${this.userSettings.performanceOverlay()
? translateText("user_setting.performance_overlay_enabled")
: translateText(
"user_setting.performance_overlay_disabled",
)}
"user_setting.performance_overlay_disabled",
)}
</div>
</div>
<div class="text-sm text-slate-400">
@@ -353,12 +353,12 @@ export class StructureIconsLayer implements Layer {
const shape = STRUCTURE_SHAPES[structureType];
const texture = shape
? this.createIcon(
unit.owner(),
structureType,
isConstruction,
shape,
renderIcon,
)
unit.owner(),
structureType,
isConstruction,
shape,
renderIcon,
)
: PIXI.Texture.EMPTY;
this.textureCache.set(cacheKey, texture);
+7 -7
View File
@@ -57,13 +57,13 @@ export async function createGameRunner(
const nations = gameStart.config.disableNPCs
? []
: gameMap.manifest.nations.map(
(n) =>
new Nation(
new Cell(n.coordinates[0], n.coordinates[1]),
n.strength,
new PlayerInfo(n.name, PlayerType.FakeHuman, null, random.nextID()),
),
);
(n) =>
new Nation(
new Cell(n.coordinates[0], n.coordinates[1]),
n.strength,
new PlayerInfo(n.name, PlayerType.FakeHuman, null, random.nextID()),
),
);
const game: Game = createGame(
humans,
+2 -2
View File
@@ -455,8 +455,8 @@ export class FakeHumanExecution implements Execution {
const tiles =
type === UnitType.Port
? Array.from(this.player.borderTiles()).filter((t) =>
this.mg.isOceanShore(t),
)
this.mg.isOceanShore(t),
)
: Array.from(this.player.tiles());
if (tiles.length === 0) return null;
return this.random.randElement(tiles);
+3 -3
View File
@@ -43,9 +43,9 @@ export class RailroadExecution implements Execution {
railType:
tiles.length > 0
? this.computeExtremityDirection(
tiles[tiles.length - 1],
tiles[tiles.length - 2],
)
tiles[tiles.length - 1],
tiles[tiles.length - 2],
)
: RailType.VERTICAL,
});
}
+10 -10
View File
@@ -11,19 +11,19 @@ export enum PathFindResultType {
}
export type AStarResult<NodeType> =
| {
type: PathFindResultType.NextTile;
node: NodeType;
}
type: PathFindResultType.NextTile;
node: NodeType;
}
| {
type: PathFindResultType.Pending;
}
type: PathFindResultType.Pending;
}
| {
type: PathFindResultType.Completed;
node: NodeType;
}
type: PathFindResultType.Completed;
node: NodeType;
}
| {
type: PathFindResultType.PathNotFound;
};
type: PathFindResultType.PathNotFound;
};
export type Point = {
x: number;
+3 -3
View File
@@ -11,9 +11,9 @@ import { PersistentIdSchema } from "../core/Schemas";
type TokenVerificationResult =
| {
persistentId: string;
claims: TokenPayload | null;
}
persistentId: string;
claims: TokenPayload | null;
}
| false;
export async function verifyClientToken(
@@ -63,14 +63,14 @@ async function handleJoinMessage(
): Promise<
| undefined
| {
success: true;
}
success: true;
}
| {
success: false;
code: 1002;
description: string;
error?: string;
reason:
success: false;
code: 1002;
description: string;
error?: string;
reason:
| "ClientJoinMessageSchema"
| "Flag invalid"
| "Flag restricted"
@@ -80,20 +80,20 @@ async function handleJoinMessage(
| "Pattern restricted"
| "Pattern unlisted"
| "Unauthorized";
}
}
| {
success: false;
code: 1011;
reason: "Internal server error";
error: string;
description: string;
}
success: false;
code: 1011;
reason: "Internal server error";
error: string;
description: string;
}
> {
const forwarded = req.headers["x-forwarded-for"];
const ip = Array.isArray(forwarded)
? forwarded[0]
: // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
forwarded || req.socket.remoteAddress || "unknown";
forwarded || req.socket.remoteAddress || "unknown";
try {
// Parse and handle client messages