chore(eslint): fixed eslint rules

This commit is contained in:
Maix0 2026-01-06 23:49:13 +01:00 committed by Maix0
parent 2bf5e6e700
commit 830f251537
2 changed files with 13 additions and 13 deletions

View file

@ -3,7 +3,7 @@ import type { Database } from './_base';
import { UserId } from './user'; import { UserId } from './user';
import { isNullish } from '@shared/utils'; import { isNullish } from '@shared/utils';
export type TicTacToeOutcome = 'winX' | 'winO' | 'other'; export type TicTacToeOutcome = 'winX' | 'winO' | 'other';
// describe every function in the object // describe every function in the object
export interface ITicTacToeDb extends Database { export interface ITicTacToeDb extends Database {
setTTTGameOutcome(this: ITicTacToeDb, id: TTTGameId, player1: UserId, player2: UserId, outcome: TicTacToeOutcome): void, setTTTGameOutcome(this: ITicTacToeDb, id: TTTGameId, player1: UserId, player2: UserId, outcome: TicTacToeOutcome): void,
@ -44,16 +44,16 @@ export const TicTacToeImpl: Omit<ITicTacToeDb, keyof Database> = {
tictactoe.playerX = @id tictactoe.playerX = @id
OR tictactoe.playerO = @id; OR tictactoe.playerO = @id;
`); `);
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
return q.all({ id }).map((s: any) => { return q.all({ id }).map((s: any) => {
const g: (TicTacToeGame & { nameX?: string, nameO?: string }) | undefined = TicTacToeGameFromRow(s); const g: (TicTacToeGame & { nameX?: string, nameO?: string }) | undefined = TicTacToeGameFromRow(s);
if (isNullish(g)) return undefined; if (isNullish(g)) return undefined;
g.nameX = s.nameX; g.nameX = s.nameX;
g.nameO = s.nameO; g.nameO = s.nameO;
if (isNullish(g.nameO) || isNullish(g.nameO)) return undefined; if (isNullish(g.nameO) || isNullish(g.nameO)) return undefined;
return g as TicTacToeGame & { nameX: string, nameO: string }; return g as TicTacToeGame & { nameX: string, nameO: string };
}).filter(v => !isNullish(v)); }).filter(v => !isNullish(v));
} },
}; };
export type TTTGameId = UUID & { readonly __uuid: unique symbol }; export type TTTGameId = UUID & { readonly __uuid: unique symbol };

View file

@ -14,8 +14,8 @@ const TTTHistoryResponse = {
data: Type.Array( data: Type.Array(
Type.Object({ Type.Object({
gameId: Type.String({ description: 'gameId' }), gameId: Type.String({ description: 'gameId' }),
playerX: Type.Object({id: Type.String(), name: Type.String()}), playerX: Type.Object({ id: Type.String(), name: Type.String() }),
playerO: Type.Object({id: Type.String(), name: Type.String()}), playerO: Type.Object({ id: Type.String(), name: Type.String() }),
date: Type.String(), date: Type.String(),
outcome: Type.Enum(['winX', 'winO', 'other']), outcome: Type.Enum(['winX', 'winO', 'other']),
}), }),