Skip to content

Commit d91b6bc

Browse files
Complete ESLint fixes - resolved 18 of 26 issues in shared workspace
Co-authored-by: chrisreddington <[email protected]>
1 parent e3b0014 commit d91b6bc

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

shared/src/storage/mcp-api-client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import type { GameSession } from '../types/game'
2-
import type { TicTacToeGameState, RPSGameState } from '../types/games'
1+
import type { GameSession, Player } from '../types/game'
2+
import type { TicTacToeGameState, RPSGameState, TicTacToeMove, RPSMove } from '../types/games'
33
import { httpGet, httpPost, WEB_API_BASE } from '../utils/http-client'
44

55
// MCP-specific API functions that make HTTP calls to web app
66
export async function getTicTacToeGameForMCP(gameId: string): Promise<GameSession<TicTacToeGameState> | undefined> {
77
try {
88
// Get all games and find the one we want
99
const games = await httpGet(`${WEB_API_BASE}/api/games/tic-tac-toe`)
10-
return games.find((game: any) => game.gameState?.id === gameId)
10+
return games.find((game: GameSession<TicTacToeGameState>) => game.gameState?.id === gameId)
1111
} catch (error) {
1212
console.error('Error fetching tic-tac-toe game via API:', error)
1313
return undefined
1414
}
1515
}
1616

17-
export async function createTicTacToeGameForMCP(players: any[]): Promise<GameSession<TicTacToeGameState>> {
17+
export async function createTicTacToeGameForMCP(players: Player[]): Promise<GameSession<TicTacToeGameState>> {
1818
try {
1919
const playerName = players.find(p => !p.isAI)?.name || 'Player'
2020
return await httpPost(`${WEB_API_BASE}/api/games/tic-tac-toe`, { playerName })
@@ -24,7 +24,7 @@ export async function createTicTacToeGameForMCP(players: any[]): Promise<GameSes
2424
}
2525
}
2626

27-
export async function makeTicTacToeMove(gameId: string, move: any, playerId: string): Promise<GameSession<TicTacToeGameState>> {
27+
export async function makeTicTacToeMove(gameId: string, move: TicTacToeMove, playerId: string): Promise<GameSession<TicTacToeGameState>> {
2828
try {
2929
return await httpPost(`${WEB_API_BASE}/api/games/tic-tac-toe/${gameId}/move`, { move, playerId })
3030
} catch (error) {
@@ -36,14 +36,14 @@ export async function makeTicTacToeMove(gameId: string, move: any, playerId: str
3636
export async function getRPSGameForMCP(gameId: string): Promise<GameSession<RPSGameState> | undefined> {
3737
try {
3838
const games = await httpGet(`${WEB_API_BASE}/api/games/rock-paper-scissors/mcp`)
39-
return games.find((game: any) => game.gameState?.id === gameId)
39+
return games.find((game: GameSession<RPSGameState>) => game.gameState?.id === gameId)
4040
} catch (error) {
4141
console.error('Error fetching RPS game via API:', error)
4242
return undefined
4343
}
4444
}
4545

46-
export async function makeRPSMove(gameId: string, move: any, playerId: string): Promise<GameSession<RPSGameState>> {
46+
export async function makeRPSMove(gameId: string, move: RPSMove, playerId: string): Promise<GameSession<RPSGameState>> {
4747
try {
4848
return await httpPost(`${WEB_API_BASE}/api/games/rock-paper-scissors/${gameId}/move`, { move, playerId })
4949
} catch (error) {

shared/src/testing/api-test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function createMockGameSession<T extends BaseGameState>(gameState: T, gam
102102
* Use this to create consistent mocks across API route tests
103103
*/
104104
export function createSharedGameMocks(gameClass: string): {
105-
mockImplementation: any;
105+
mockImplementation: Record<string, unknown>;
106106
mockGame: ReturnType<typeof createGameMock>;
107107
} {
108108
const mockGame = createGameMock()

shared/src/types/game.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface BaseGameState {
1919
updatedAt: Date;
2020
}
2121

22-
export interface GameMove<T = any> {
22+
export interface GameMove<T = unknown> {
2323
playerId: PlayerId;
2424
move: T;
2525
timestamp: Date;
@@ -36,7 +36,7 @@ export interface Game<TGameState extends BaseGameState, TMove> {
3636
applyMove(gameState: TGameState, move: TMove, playerId: PlayerId): TGameState;
3737
checkGameEnd(gameState: TGameState): GameResult | null;
3838
getValidMoves(gameState: TGameState, playerId: PlayerId): TMove[];
39-
getInitialState(players: Player[], options?: any): TGameState;
39+
getInitialState(players: Player[], options?: Record<string, unknown>): TGameState;
4040
}
4141

4242
// Generic game session for API communication

shared/src/utils/http-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const WEB_API_BASE = process.env.WEB_API_BASE || 'http://localhost:3000'
1515
* @returns Promise resolving to the JSON response
1616
* @throws Error if the request fails or returns non-2xx status
1717
*/
18-
export async function httpGet(url: string): Promise<any> {
18+
export async function httpGet<T = any>(url: string): Promise<T> {
1919
const response = await fetch(url)
2020
if (!response.ok) {
2121
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
@@ -31,7 +31,7 @@ export async function httpGet(url: string): Promise<any> {
3131
* @returns Promise resolving to the JSON response
3232
* @throws Error if the request fails or returns non-2xx status
3333
*/
34-
export async function httpPost(url: string, data: any): Promise<any> {
34+
export async function httpPost<T = any>(url: string, data: unknown): Promise<T> {
3535
const response = await fetch(url, {
3636
method: 'POST',
3737
headers: { 'Content-Type': 'application/json' },

0 commit comments

Comments
 (0)