Skip to content

Commit de38418

Browse files
chore: apply biome unsafe checks
1 parent ffd6867 commit de38418

File tree

11 files changed

+51
-45
lines changed

11 files changed

+51
-45
lines changed

src/game.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ export class Game {
109109
this.#selectedCell = null;
110110

111111
if (!this.#board.cellsFlat.some((cell) => cell.owner === "black")) {
112-
this.#HTMLGameOverDialog.showModal()
113-
this.#HTMLGameOverDialog.children[0].textContent = "Game over! White is the winner."
112+
this.#HTMLGameOverDialog.showModal();
113+
this.#HTMLGameOverDialog.children[0].textContent =
114+
"Game over! White is the winner.";
114115
}
115116

116117
if (!this.#board.cellsFlat.some((cell) => cell.owner === "white")) {
117-
this.#HTMLGameOverDialog.showModal()
118-
this.#HTMLGameOverDialog.children[0].textContent = "Game over! Black is the winner."
118+
this.#HTMLGameOverDialog.showModal();
119+
this.#HTMLGameOverDialog.children[0].textContent =
120+
"Game over! Black is the winner.";
119121
}
120122

121123
for (const cell of this.#board.cellsFlat.filter(

src/pieces/amazon.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Bishop } from "./bishop";
33
import { BishopKnight } from "./bishopKnight";
44
import { BishopRook } from "./bishopRook";
@@ -35,8 +35,8 @@ export class Amazon implements Piece {
3535
}
3636

3737
highlightMoves(cells: Cell[][], x: number, y: number): void {
38-
new Knight(this.#color).highlightMoves(cells, x, y)
39-
new Rook(this.#color).highlightMoves(cells, x, y)
40-
new Bishop(this.#color).highlightMoves(cells, x, y)
38+
new Knight(this.#color).highlightMoves(cells, x, y);
39+
new Rook(this.#color).highlightMoves(cells, x, y);
40+
new Bishop(this.#color).highlightMoves(cells, x, y);
4141
}
4242
}

src/pieces/bishop.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Pawn } from "./pawn";
33
import type { Piece } from "./piece";
44

@@ -27,41 +27,45 @@ export class Bishop implements Piece {
2727

2828
highlightMoves(cells: Cell[][], x: number, y: number): void {
2929
for (let yi = y - 1, xi = x - 1; yi >= 0 && xi >= 0; yi--, xi--) {
30-
const cell = cells[yi][xi]
30+
const cell = cells[yi][xi];
3131
if (cell.building === "wall" || cell.piece?.color === this.#color) {
3232
break;
3333
}
34-
cell.highlight()
34+
cell.highlight();
3535
if (cell.piece) {
3636
break;
3737
}
3838
}
3939
for (let yi = y + 1, xi = x - 1; yi < cells.length && xi >= 0; yi++, xi--) {
40-
const cell = cells[yi][xi]
40+
const cell = cells[yi][xi];
4141
if (cell.building === "wall" || cell.piece?.color === this.#color) {
4242
break;
4343
}
44-
cell.highlight()
44+
cell.highlight();
4545
if (cell.piece) {
4646
break;
4747
}
4848
}
49-
for (let yi = y + 1, xi = x + 1; yi < cells.length && xi < cells.length; yi++, xi++) {
50-
const cell = cells[yi][xi]
49+
for (
50+
let yi = y + 1, xi = x + 1;
51+
yi < cells.length && xi < cells.length;
52+
yi++, xi++
53+
) {
54+
const cell = cells[yi][xi];
5155
if (cell.building === "wall" || cell.piece?.color === this.#color) {
5256
break;
5357
}
54-
cell.highlight()
58+
cell.highlight();
5559
if (cell.piece) {
5660
break;
5761
}
5862
}
5963
for (let yi = y - 1, xi = x + 1; yi >= 0 && xi < cells.length; yi--, xi++) {
60-
const cell = cells[yi][xi]
64+
const cell = cells[yi][xi];
6165
if (cell.building === "wall" || cell.piece?.color === this.#color) {
6266
break;
6367
}
64-
cell.highlight()
68+
cell.highlight();
6569
if (cell.piece) {
6670
break;
6771
}

src/pieces/bishopKnight.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Bishop } from "./bishop";
33
import { Knight } from "./knight";
44
import type { Piece } from "./piece";
@@ -27,7 +27,7 @@ export class BishopKnight implements Piece {
2727
}
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
30-
new Knight(this.#color).highlightMoves(cells, x, y)
31-
new Bishop(this.#color).highlightMoves(cells, x, y)
30+
new Knight(this.#color).highlightMoves(cells, x, y);
31+
new Bishop(this.#color).highlightMoves(cells, x, y);
3232
}
3333
}

src/pieces/bishopRook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Bishop } from "./bishop";
33
import type { Piece } from "./piece";
44
import { Rook } from "./rook";
@@ -27,7 +27,7 @@ export class BishopRook implements Piece {
2727
}
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
30-
new Rook(this.#color).highlightMoves(cells, x, y)
31-
new Bishop(this.#color).highlightMoves(cells, x, y)
30+
new Rook(this.#color).highlightMoves(cells, x, y);
31+
new Bishop(this.#color).highlightMoves(cells, x, y);
3232
}
3333
}

src/pieces/knight.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Pawn } from "./pawn";
33
import type { Piece } from "./piece";
44

src/pieces/knightRook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Knight } from "./knight";
33
import type { Piece } from "./piece";
44
import { Rook } from "./rook";
@@ -27,7 +27,7 @@ export class KnightRook implements Piece {
2727
}
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
30-
new Knight(this.#color).highlightMoves(cells, x, y)
31-
new Rook(this.#color).highlightMoves(cells, x, y)
30+
new Knight(this.#color).highlightMoves(cells, x, y);
31+
new Rook(this.#color).highlightMoves(cells, x, y);
3232
}
3333
}

src/pieces/pawnBishop.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Bishop } from "./bishop";
33
import { Pawn } from "./pawn";
44
import type { Piece } from "./piece";
@@ -27,7 +27,7 @@ export class PawnBishop implements Piece {
2727
}
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
30-
new Pawn(this.#color).highlightMoves(cells, x, y)
31-
new Bishop(this.#color).highlightMoves(cells, x, y)
30+
new Pawn(this.#color).highlightMoves(cells, x, y);
31+
new Bishop(this.#color).highlightMoves(cells, x, y);
3232
}
3333
}

src/pieces/pawnKnight.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class PawnKnight implements Piece {
2727
}
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
30-
new Pawn(this.#color).highlightMoves(cells, x, y)
31-
new Knight(this.#color).highlightMoves(cells, x, y)
30+
new Pawn(this.#color).highlightMoves(cells, x, y);
31+
new Knight(this.#color).highlightMoves(cells, x, y);
3232
}
3333
}

src/pieces/pawnRook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Pawn } from "./pawn";
33
import type { Piece } from "./piece";
44
import { Rook } from "./rook";
@@ -27,7 +27,7 @@ export class PawnRook implements Piece {
2727
}
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
30-
new Pawn(this.#color).highlightMoves(cells, x, y)
31-
new Rook(this.#color).highlightMoves(cells, x, y)
30+
new Pawn(this.#color).highlightMoves(cells, x, y);
31+
new Rook(this.#color).highlightMoves(cells, x, y);
3232
}
3333
}

src/pieces/rook.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cell } from "../cell";
1+
import type { Cell } from "../cell";
22
import { Bishop } from "./bishop";
33
import { Knight } from "./knight";
44
import type { Piece } from "./piece";
@@ -28,41 +28,41 @@ export class Rook implements Piece {
2828

2929
highlightMoves(cells: Cell[][], x: number, y: number): void {
3030
for (let yi = y - 1; yi >= 0; yi--) {
31-
const cell = cells[yi][x]
31+
const cell = cells[yi][x];
3232
if (cell.building === "wall" || cell.piece?.color === this.#color) {
3333
break;
3434
}
35-
cell.highlight()
35+
cell.highlight();
3636
if (cell.piece) {
3737
break;
3838
}
3939
}
4040
for (let yi = y + 1; yi < cells.length; yi++) {
41-
const cell = cells[yi][x]
41+
const cell = cells[yi][x];
4242
if (cell.building === "wall" || cell.piece?.color === this.#color) {
4343
break;
4444
}
45-
cell.highlight()
45+
cell.highlight();
4646
if (cell.piece) {
4747
break;
4848
}
4949
}
5050
for (let xi = x - 1; xi >= 0; xi--) {
51-
const cell = cells[y][xi]
51+
const cell = cells[y][xi];
5252
if (cell.building === "wall" || cell.piece?.color === this.#color) {
5353
break;
5454
}
55-
cell.highlight()
55+
cell.highlight();
5656
if (cell.piece) {
5757
break;
5858
}
5959
}
6060
for (let xi = x + 1; xi < cells.length; xi++) {
61-
const cell = cells[y][xi]
61+
const cell = cells[y][xi];
6262
if (cell.building === "wall" || cell.piece?.color === this.#color) {
6363
break;
6464
}
65-
cell.highlight()
65+
cell.highlight();
6666
if (cell.piece) {
6767
break;
6868
}

0 commit comments

Comments
 (0)