refactor(misskey-games): Misskey Games系パッケージのlint修正+Lint CI整備 (#14612)

* chore(lint): Fix linting in misskey-reversi

(cherry picked from commit 894934a1a7743472b2d051e2690007ae373efd76)

* chore(lint): Fix linting in misskey-bubble-game

(cherry picked from commit 1ba9c37a8d5e4ae6a98494026b87f6f6439790c7)

* enhance(gh): add lint ci for misskey games packages

* enhance(gh): fix lint ci

* fix

* revert some changes that nothing to do with lint rules

* fix

* lint fixes

* refactor: strict type def

* lint fixes

* 🎨

* 🎨

---------

Co-authored-by: 4censord <mail@4censord.de>
This commit is contained in:
かっこかり
2024-09-23 21:25:23 +09:00
committed by GitHub
parent 733fd56058
commit 7f7445ad7a
7 changed files with 68 additions and 45 deletions

View File

@@ -53,9 +53,13 @@ export class Game {
//#region Options
this.opts = opts;
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
if (this.opts.isLlotheo == null) this.opts.isLlotheo = false;
if (this.opts.canPutEverywhere == null) this.opts.canPutEverywhere = false;
if (this.opts.loopedBoard == null) this.opts.loopedBoard = false;
/* eslint-enable */
//#endregion
//#region Parse map data
@@ -123,12 +127,13 @@ export class Game {
// ターン計算
this.turn =
this.canPutSomewhere(!this.prevColor) ? !this.prevColor :
this.canPutSomewhere(this.prevColor!) ? this.prevColor :
this.canPutSomewhere(this.prevColor!) ? this.prevColor : //eslint-disable-line @typescript-eslint/no-non-null-assertion
null;
}
public undo() {
const undo = this.logs.pop()!;
const undo = this.logs.pop();
if (undo == null) return;
this.prevColor = undo.color;
this.prevPos = undo.pos;
this.board[undo.pos] = null;
@@ -183,7 +188,7 @@ export class Game {
const found: number[] = []; // 挟めるかもしれない相手の石を入れておく配列
let [x, y] = this.posToXy(initPos);
while (true) {
while (true) { // eslint-disable-line @typescript-eslint/no-unnecessary-condition
[x, y] = nextPos(x, y);
// 座標が指し示す位置がボード外に出たとき