fix: lint
This commit is contained in:
parent
131605070a
commit
977218bda5
|
@ -1,31 +1,31 @@
|
|||
import { build } from "esbuild";
|
||||
import { globSync } from "glob";
|
||||
import { build } from 'esbuild';
|
||||
import { globSync } from 'glob';
|
||||
|
||||
const entryPoints = globSync("./src/**/**.{ts,tsx}");
|
||||
const entryPoints = globSync('./src/**/**.{ts,tsx}');
|
||||
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const options = {
|
||||
entryPoints,
|
||||
minify: true,
|
||||
outdir: "./built/esm",
|
||||
target: "es2022",
|
||||
platform: "browser",
|
||||
format: "esm",
|
||||
entryPoints,
|
||||
minify: true,
|
||||
outdir: './built/esm',
|
||||
target: 'es2022',
|
||||
platform: 'browser',
|
||||
format: 'esm',
|
||||
};
|
||||
|
||||
if (process.env.WATCH === "true") {
|
||||
options.watch = {
|
||||
onRebuild(error, result) {
|
||||
if (error) {
|
||||
console.error("watch build failed:", error);
|
||||
} else {
|
||||
console.log("watch build succeeded:", result);
|
||||
}
|
||||
},
|
||||
};
|
||||
if (process.env.WATCH === 'true') {
|
||||
options.watch = {
|
||||
onRebuild(error, result) {
|
||||
if (error) {
|
||||
console.error('watch build failed:', error);
|
||||
} else {
|
||||
console.log('watch build succeeded:', result);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
build(options).catch((err) => {
|
||||
process.stderr.write(err.stderr);
|
||||
process.exit(1);
|
||||
process.stderr.write(err.stderr);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { FourMentsuOneJyantou, mentsuEquals, TILE_NUMBER_MAP, TileType } from "./common.js";
|
||||
import { FourMentsuOneJyantou, mentsuEquals, TILE_NUMBER_MAP, TileType } from './common.js';
|
||||
|
||||
export type Shape = 'fourMentsuOneJyantou' | 'chitoitsu' | 'kokushi';
|
||||
|
||||
|
@ -24,7 +24,7 @@ export function calcWaitPatterns(fourMentsuOneJyantou: FourMentsuOneJyantou | nu
|
|||
|
||||
const result: FourMentsuOneJyantouWithWait[] = [];
|
||||
|
||||
if (fourMentsuOneJyantou.head == agariTile) {
|
||||
if (fourMentsuOneJyantou.head === agariTile) {
|
||||
result.push({
|
||||
head: fourMentsuOneJyantou.head,
|
||||
mentsus: fourMentsuOneJyantou.mentsus,
|
||||
|
@ -44,7 +44,7 @@ export function calcWaitPatterns(fourMentsuOneJyantou: FourMentsuOneJyantou | nu
|
|||
waitedFor: 'mentsu',
|
||||
agariTile,
|
||||
waitedTaatsu: mentsu.toSpliced(agariTileIndex, 1) as [TileType, TileType],
|
||||
})
|
||||
});
|
||||
checkedMentsus.push(mentsu);
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ export function isRyanmen(taatsu: [TileType, TileType]): boolean {
|
|||
const number1 = TILE_NUMBER_MAP[taatsu[0]];
|
||||
const number2 = TILE_NUMBER_MAP[taatsu[1]];
|
||||
if (number1 == null || number2 == null) return false;
|
||||
return number1 != 1 && number2 != 9 && number1 + 1 == number2;
|
||||
return number1 !== 1 && number2 !== 9 && number1 + 1 === number2;
|
||||
}
|
||||
|
||||
export function isToitsu(taatsu: [TileType, TileType]): boolean {
|
||||
return taatsu[0] == taatsu[1];
|
||||
return taatsu[0] === taatsu[1];
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ export type TileId = number;
|
|||
|
||||
// NOTE: 0 は"不明"(他プレイヤーの手牌など)を表すものとして予約されている
|
||||
export const TILE_ID_MAP = new Map<TileId, TileInstance>([
|
||||
/* eslint-disable no-multi-spaces */
|
||||
/* eslint-disable @stylistic/no-multi-spaces */
|
||||
[1, { t: 'm1' }], [2, { t: 'm1' }], [3, { t: 'm1' }], [4, { t: 'm1' }],
|
||||
[5, { t: 'm2' }], [6, { t: 'm2' }], [7, { t: 'm2' }], [8, { t: 'm2' }],
|
||||
[9, { t: 'm3' }], [10, { t: 'm3' }], [11, { t: 'm3' }], [12, { t: 'm3' }],
|
||||
|
@ -89,7 +89,7 @@ export const TILE_ID_MAP = new Map<TileId, TileInstance>([
|
|||
[125, { t: 'haku' }], [126, { t: 'haku' }], [127, { t: 'haku' }], [128, { t: 'haku' }],
|
||||
[129, { t: 'hatsu' }], [130, { t: 'hatsu' }], [131, { t: 'hatsu' }], [132, { t: 'hatsu' }],
|
||||
[133, { t: 'chun' }], [134, { t: 'chun' }], [135, { t: 'chun' }], [136, { t: 'chun' }],
|
||||
/* eslint-enable no-multi-spaces */
|
||||
/* eslint-enable @stylistic/no-multi-spaces */
|
||||
]);
|
||||
|
||||
export function findTileByIdOrFail(tid: TileId): TileInstance {
|
||||
|
@ -130,7 +130,7 @@ export type PointFactor = {
|
|||
} | {
|
||||
isYakuman: true;
|
||||
value: number;
|
||||
}
|
||||
};
|
||||
|
||||
export const CALL_HURO_TYPES = ['pon', 'cii', 'minkan'] as const;
|
||||
|
||||
|
@ -386,7 +386,7 @@ export function calcTsumoHoraPointDeltas(house: House, fansOrFactor: number | Po
|
|||
n: 0,
|
||||
};
|
||||
|
||||
const point = typeof fansOrFactor == 'number' ? fanToPoint(fansOrFactor, isParent) : calcPoint(fansOrFactor, isParent);
|
||||
const point = typeof fansOrFactor === 'number' ? fanToPoint(fansOrFactor, isParent) : calcPoint(fansOrFactor, isParent);
|
||||
deltas[house] = point;
|
||||
if (isParent) {
|
||||
const childPoint = Math.ceil(point / 3);
|
||||
|
@ -464,7 +464,7 @@ export function isKotsu(tiles: [TileType, TileType, TileType]): boolean {
|
|||
}
|
||||
|
||||
export function mentsuEquals(tiles1: [TileType, TileType, TileType], tiles2: [TileType, TileType, TileType]): boolean {
|
||||
return tiles1[0] == tiles2[0] && tiles1[1] == tiles2[1] && tiles1[2] == tiles2[2];
|
||||
return tiles1[0] === tiles2[0] && tiles1[1] === tiles2[1] && tiles1[2] === tiles2[2];
|
||||
}
|
||||
|
||||
export const SHUNTU_PATTERNS: [TileType, TileType, TileType][] = [
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -613,7 +613,7 @@ export class MasterGameEngine {
|
|||
public commit_kakan(house: House, tid: TileId) {
|
||||
const tx = this.startTransaction();
|
||||
|
||||
const pon = tx.$state.huros[house].find(h => h.type === 'pon' && $type(h.tiles[0]) === $type(tid)) as Huro & {type: 'pon'};
|
||||
const pon = tx.$state.huros[house].find(h => h.type === 'pon' && $type(h.tiles[0]) === $type(tid)) as Huro & { type: 'pon' };
|
||||
if (pon == null) throw new Error('No such pon');
|
||||
tx.$state.handTiles[house].splice(tx.$state.handTiles[house].indexOf(tid), 1);
|
||||
const tiles = [tid, ...pon.tiles] as const;
|
||||
|
@ -686,7 +686,7 @@ export class MasterGameEngine {
|
|||
doubleRiichi: tx.$state.doubleRiichis[house],
|
||||
ippatsu: tx.$state.ippatsus[house],
|
||||
rinshan: tx.$state.rinshanFlags[house],
|
||||
haitei: tx.$state.tiles.length == 0,
|
||||
haitei: tx.$state.tiles.length === 0,
|
||||
});
|
||||
const doraCount =
|
||||
Common.calcOwnedDoraCount(tx.handTileTypes[house], tx.$state.huros[house], tx.doras) +
|
||||
|
@ -743,7 +743,7 @@ export class MasterGameEngine {
|
|||
riichi: tx.$state.riichis[house],
|
||||
doubleRiichi: tx.$state.doubleRiichis[house],
|
||||
ippatsu: tx.$state.ippatsus[house],
|
||||
hotei: tx.$state.tiles.length == 0,
|
||||
hotei: tx.$state.tiles.length === 0,
|
||||
});
|
||||
const doraCount =
|
||||
Common.calcOwnedDoraCount(tx.handTileTypes[house], tx.$state.huros[house], tx.doras) +
|
||||
|
|
|
@ -270,7 +270,7 @@ export class PlayerGameEngine {
|
|||
doubleRiichi: this.state.doubleRiichis[house],
|
||||
ippatsu: this.state.ippatsus[house],
|
||||
rinshan: this.state.rinshanFlags[house],
|
||||
haitei: this.state.tilesCount == 0,
|
||||
haitei: this.state.tilesCount === 0,
|
||||
});
|
||||
const doraCount =
|
||||
Common.calcOwnedDoraCount(handTiles.map(id => $type(id)), this.state.huros[house], this.doras) +
|
||||
|
@ -322,7 +322,7 @@ export class PlayerGameEngine {
|
|||
riichi: this.state.riichis[house],
|
||||
doubleRiichi: this.state.doubleRiichis[house],
|
||||
ippatsu: this.state.ippatsus[house],
|
||||
hotei: this.state.tilesCount == 0,
|
||||
hotei: this.state.tilesCount === 0,
|
||||
});
|
||||
const doraCount =
|
||||
Common.calcOwnedDoraCount(handTiles[house].map(id => $type(id)), this.state.huros[house], this.doras) +
|
||||
|
|
Loading…
Reference in New Issue