enable eslint rule curly: multi-line

https://eslint.org/docs/latest/rules/curly#multi-line
This commit is contained in:
Scott Anderson
2025-08-07 21:35:08 -04:00
parent d1b5c80ccd
commit 91974aa906
9 changed files with 39 additions and 19 deletions
+1
View File
@@ -49,6 +49,7 @@ export default [
rules: {
// Enable rules
"@typescript-eslint/prefer-nullish-coalescing": "error",
curly: ["error", "multi-line"],
eqeqeq: "error",
"sort-keys": "error",
},
+8 -4
View File
@@ -214,23 +214,27 @@ export class InputHandler {
if (
this.activeKeys.has(this.keybinds.moveUp) ||
this.activeKeys.has("ArrowUp")
)
) {
deltaY += this.PAN_SPEED;
}
if (
this.activeKeys.has(this.keybinds.moveDown) ||
this.activeKeys.has("ArrowDown")
)
) {
deltaY -= this.PAN_SPEED;
}
if (
this.activeKeys.has(this.keybinds.moveLeft) ||
this.activeKeys.has("ArrowLeft")
)
) {
deltaX += this.PAN_SPEED;
}
if (
this.activeKeys.has(this.keybinds.moveRight) ||
this.activeKeys.has("ArrowRight")
)
) {
deltaX -= this.PAN_SPEED;
}
if (deltaX || deltaY) {
this.eventBus.emit(new DragEvent(deltaX, deltaY));
+4 -2
View File
@@ -212,8 +212,9 @@ class Client {
"territory-patterns-input-preview-button",
);
territoryModal instanceof TerritoryPatternsModal;
if (patternButton === null)
if (patternButton === null) {
throw new Error("territory-patterns-input-preview-button");
}
territoryModal.previewButton = patternButton;
territoryModal.updatePreview();
territoryModal.resizeObserver = new ResizeObserver((entries) => {
@@ -371,8 +372,9 @@ class Client {
const joinPrivateLobbyButton = document.getElementById(
"join-private-lobby-button",
);
if (joinPrivateLobbyButton === null)
if (joinPrivateLobbyButton === null) {
throw new Error("Missing join-private-lobby-button");
}
joinPrivateLobbyButton.addEventListener("click", () => {
if (this.usernameInput?.isValid()) {
this.joinModal.open();
+2 -1
View File
@@ -75,8 +75,9 @@ export class PublicLobby extends LitElement {
async fetchLobbies(): Promise<GameInfo[]> {
try {
const response = await fetch(`/api/public_lobbies`);
if (!response.ok)
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.lobbies;
} catch (error) {
+6 -3
View File
@@ -417,8 +417,9 @@ export class RadialMenu implements Layer {
(this.currentLevel > 0 &&
level === 0 &&
d.data.id === this.selectedItemId)
)
) {
return;
}
path.attr("filter", null);
path.attr("stroke-width", "2");
const color = disabled
@@ -437,15 +438,17 @@ export class RadialMenu implements Layer {
this.params === null ||
d.data.disabled(this.params) ||
this.navigationInProgress
)
) {
return;
}
if (
this.currentLevel > 0 &&
level === 0 &&
d.data.id !== this.selectedItemId
)
) {
return;
}
const subMenu = d.data.subMenu?.(this.params);
if (subMenu && subMenu.length > 0) {
+4 -2
View File
@@ -112,13 +112,15 @@ class SAMTargetingSystem {
if (
a.unit.type() === UnitType.HydrogenBomb &&
b.unit.type() !== UnitType.HydrogenBomb
)
) {
return -1;
}
if (
a.unit.type() !== UnitType.HydrogenBomb &&
b.unit.type() === UnitType.HydrogenBomb
)
) {
return 1;
}
return 0;
})[0] ?? null
+8 -4
View File
@@ -124,25 +124,29 @@ export class WarshipExecution implements Execution {
if (
unitA.type() === UnitType.TransportShip &&
unitB.type() !== UnitType.TransportShip
)
) {
return -1;
}
if (
unitA.type() !== UnitType.TransportShip &&
unitB.type() === UnitType.TransportShip
)
) {
return 1;
}
// Then prioritize Warships.
if (
unitA.type() === UnitType.Warship &&
unitB.type() !== UnitType.Warship
)
) {
return -1;
}
if (
unitA.type() !== UnitType.Warship &&
unitB.type() === UnitType.Warship
)
) {
return 1;
}
// If both are the same type, sort by distance (lower `distSquared` means closer)
return distA - distB;
+4 -2
View File
@@ -286,10 +286,12 @@ export class GameImpl implements Game {
);
// Automatically remove embargoes only if they were automatically created
if (requestor.hasEmbargoAgainst(recipient))
if (requestor.hasEmbargoAgainst(recipient)) {
requestor.endTemporaryEmbargo(recipient.id());
if (recipient.hasEmbargoAgainst(requestor))
}
if (recipient.hasEmbargoAgainst(requestor)) {
recipient.endTemporaryEmbargo(requestor.id());
}
this.addUpdate({
accepted: true,
+2 -1
View File
@@ -119,8 +119,9 @@ export class SerialAStar<NodeType> implements AStar<NodeType> {
if (
neighbor !== (isForward ? this.dst : this.closestSource) &&
!this.graph.isTraversable(current, neighbor)
)
) {
continue;
}
const gScore = isForward ? this.fwdGScore : this.bwdGScore;
const openSet = isForward ? this.fwdOpenSet : this.bwdOpenSet;