From e960b5130adcf0d08622a903190d6547b3cf4b8c Mon Sep 17 00:00:00 2001 From: evanpelle Date: Wed, 6 May 2026 21:08:42 -0600 Subject: [PATCH] run formatter --- CONTRIBUTING.md | 1 + README.md | 4 ++ src/core/pathfinding/PathFinder.Parabola.ts | 4 +- src/core/worker/WorkerMessages.ts | 3 +- tests/client/clan/ClanModal.handlers.test.ts | 55 +++++++++++-------- tests/client/clan/ClanModal.rendering.test.ts | 5 +- 6 files changed, 46 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf09be982..47092e78f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,6 +101,7 @@ All new features and bug fixes should include relevant tests. We use **Vitest**. ## Submitting a Pull Request 1. **Commit your changes**: + - Write clear, concise commit messages. - Use the present tense ("Add feature" not "Added feature"). diff --git a/README.md b/README.md index 5d33f9c96..aa43002a2 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ Feel free to ask questions in the translation Discord server! To ensure code quality and project stability, we use a progressive contribution system: 1. **New Contributors**: Limited to UI improvements and small bug fixes only + - This helps you become familiar with the codebase - UI changes are easier to review and less likely to break core functionality - Small, focused PRs have a higher chance of being accepted @@ -192,17 +193,20 @@ To ensure code quality and project stability, we use a progressive contribution ### How to Contribute Successfully 1. **Before Starting Work**: + - Open an issue describing what you want to contribute - Wait for maintainer feedback before investing significant time - Small improvements can proceed directly to PR stage 2. **Code Quality Requirements**: + - All code must be well-commented and follow existing style patterns - New features should not break existing functionality - Code should be thoroughly tested before submission - All code changes in src/core _MUST_ be tested. 3. **Pull Request Process**: + - Keep PRs focused on a single feature or bug fix - Include screenshots for UI changes - Describe what testing you've performed diff --git a/src/core/pathfinding/PathFinder.Parabola.ts b/src/core/pathfinding/PathFinder.Parabola.ts index 83a6de28a..c58f49fbc 100644 --- a/src/core/pathfinding/PathFinder.Parabola.ts +++ b/src/core/pathfinding/PathFinder.Parabola.ts @@ -11,7 +11,9 @@ export interface ParabolaOptions { const PARABOLA_MIN_HEIGHT = 50; -export class ParabolaUniversalPathFinder implements SteppingPathFinder { +export class ParabolaUniversalPathFinder + implements SteppingPathFinder +{ private curve: DistanceBasedBezierCurve | null = null; private lastTo: TileRef | null = null; diff --git a/src/core/worker/WorkerMessages.ts b/src/core/worker/WorkerMessages.ts index c3d662995..5f4d3990f 100644 --- a/src/core/worker/WorkerMessages.ts +++ b/src/core/worker/WorkerMessages.ts @@ -121,7 +121,8 @@ export interface AttackClusteredPositionsMessage extends BaseWorkerMessage { attackID?: string; } -export interface AttackClusteredPositionsResultMessage extends BaseWorkerMessage { +export interface AttackClusteredPositionsResultMessage + extends BaseWorkerMessage { type: "attack_clustered_positions_result"; attacks: { id: string; positions: { x: number; y: number }[] }[]; } diff --git a/tests/client/clan/ClanModal.handlers.test.ts b/tests/client/clan/ClanModal.handlers.test.ts index ffcd97f79..39753b8b6 100644 --- a/tests/client/clan/ClanModal.handlers.test.ts +++ b/tests/client/clan/ClanModal.handlers.test.ts @@ -53,8 +53,9 @@ describe("ClanModal — handlers", () => { describe("handleApprove increments selectedClan.memberCount", () => { it("increments memberCount by 1 after successful approveClanRequest", async () => { - const { approveClanRequest, fetchClanRequests } = - await import("../../../src/client/ClanApi"); + const { approveClanRequest, fetchClanRequests } = await import( + "../../../src/client/ClanApi" + ); (approveClanRequest as ReturnType).mockResolvedValue(true); (fetchClanRequests as ReturnType).mockResolvedValueOnce({ results: [ @@ -89,8 +90,9 @@ describe("ClanModal — handlers", () => { }); it("does not increment memberCount when approveClanRequest fails", async () => { - const { approveClanRequest, fetchClanRequests } = - await import("../../../src/client/ClanApi"); + const { approveClanRequest, fetchClanRequests } = await import( + "../../../src/client/ClanApi" + ); (approveClanRequest as ReturnType).mockResolvedValue({ error: "clan_modal.error_generic", }); @@ -123,8 +125,9 @@ describe("ClanModal — handlers", () => { }); it("treats undefined memberCount as 0 and increments to 1", async () => { - const { approveClanRequest, fetchClanRequests } = - await import("../../../src/client/ClanApi"); + const { approveClanRequest, fetchClanRequests } = await import( + "../../../src/client/ClanApi" + ); (approveClanRequest as ReturnType).mockResolvedValue(true); (fetchClanRequests as ReturnType).mockResolvedValueOnce({ results: [ @@ -268,8 +271,9 @@ describe("ClanModal — handlers", () => { }); it("handleBan syncs memberCount via clan-updated event on success", async () => { - const { banClanMember, fetchClanMembers } = - await import("../../../src/client/ClanApi"); + const { banClanMember, fetchClanMembers } = await import( + "../../../src/client/ClanApi" + ); (banClanMember as ReturnType).mockResolvedValue(true); // Server returns the post-ban member total (was 5, now 4). (fetchClanMembers as ReturnType).mockResolvedValueOnce({ @@ -306,8 +310,9 @@ describe("ClanModal — handlers", () => { describe("handleUnban", () => { it("removes ban from list and decrements total on success", async () => { - const { unbanClanMember, fetchClanBans } = - await import("../../../src/client/ClanApi"); + const { unbanClanMember, fetchClanBans } = await import( + "../../../src/client/ClanApi" + ); (unbanClanMember as ReturnType).mockResolvedValue(true); (fetchClanBans as ReturnType).mockResolvedValueOnce({ results: [ @@ -372,8 +377,9 @@ describe("ClanModal — handlers", () => { }); it("calls kickMember and syncs memberCount on success", async () => { - const { kickMember, fetchClanMembers } = - await import("../../../src/client/ClanApi"); + const { kickMember, fetchClanMembers } = await import( + "../../../src/client/ClanApi" + ); (kickMember as ReturnType).mockResolvedValue(true); (fetchClanMembers as ReturnType).mockResolvedValueOnce({ results: [], @@ -405,8 +411,9 @@ describe("ClanModal — handlers", () => { }); it("does not mutate state when kickMember fails", async () => { - const { kickMember, fetchClanMembers } = - await import("../../../src/client/ClanApi"); + const { kickMember, fetchClanMembers } = await import( + "../../../src/client/ClanApi" + ); (kickMember as ReturnType).mockResolvedValue({ error: "clan_modal.error_generic", }); @@ -593,8 +600,9 @@ describe("ClanModal — handlers", () => { describe("handleJoin", () => { beforeEach(async () => { - const { fetchClanDetail, fetchClanStats } = - await import("../../../src/client/ClanApi"); + const { fetchClanDetail, fetchClanStats } = await import( + "../../../src/client/ClanApi" + ); (fetchClanDetail as ReturnType).mockResolvedValueOnce( makeClan({ isOpen: true, memberCount: 5 }), ); @@ -607,8 +615,9 @@ describe("ClanModal — handlers", () => { }); it("switches detail view into member mode immediately after open-clan join", async () => { - const { joinClan, fetchClanMembers } = - await import("../../../src/client/ClanApi"); + const { joinClan, fetchClanMembers } = await import( + "../../../src/client/ClanApi" + ); (joinClan as ReturnType).mockResolvedValueOnce({ status: "joined", }); @@ -772,8 +781,9 @@ describe("ClanModal — handlers", () => { }); it("clears confirmAction and removes the dialog after confirming", async () => { - const { transferLeadership } = - await import("../../../src/client/ClanApi"); + const { transferLeadership } = await import( + "../../../src/client/ClanApi" + ); (transferLeadership as ReturnType).mockResolvedValue(true); const dialog = modal.querySelector("confirm-dialog"); @@ -792,8 +802,9 @@ describe("ClanModal — handlers", () => { }); it("clears confirmAction when cancel is clicked, without calling the API", async () => { - const { transferLeadership } = - await import("../../../src/client/ClanApi"); + const { transferLeadership } = await import( + "../../../src/client/ClanApi" + ); const dialog = modal.querySelector("confirm-dialog"); expect(dialog).toBeTruthy(); diff --git a/tests/client/clan/ClanModal.rendering.test.ts b/tests/client/clan/ClanModal.rendering.test.ts index a94d18585..a80c7693b 100644 --- a/tests/client/clan/ClanModal.rendering.test.ts +++ b/tests/client/clan/ClanModal.rendering.test.ts @@ -241,8 +241,9 @@ describe("ClanModal — rendering", () => { }); it("shows 0 in the stats row of the detail view when memberCount is undefined", async () => { - const { fetchClanDetail, fetchClanStats } = - await import("../../../src/client/ClanApi"); + const { fetchClanDetail, fetchClanStats } = await import( + "../../../src/client/ClanApi" + ); (fetchClanDetail as ReturnType).mockResolvedValueOnce( makeClan({ memberCount: undefined }), );