diff --git a/.lintstagedrc.yaml b/.lintstagedrc.yaml index 532c7c4..cc05b94 100644 --- a/.lintstagedrc.yaml +++ b/.lintstagedrc.yaml @@ -2,3 +2,4 @@ '**/*.{ts,tsx,css}': - bunx @biomejs/biome lint --write src - bunx @biomejs/biome format --write src + - bunx @biomejs/biome check --write src diff --git a/biome.json b/biome.json index 53d750f..bb76e63 100644 --- a/biome.json +++ b/biome.json @@ -19,7 +19,7 @@ "indentStyle": "space", "indentWidth": 2, "lineEnding": "lf", - "lineWidth": 80 + "lineWidth": 100 }, "javascript": { "formatter": { @@ -39,6 +39,7 @@ }, "json": { "formatter": { + "enabled": true, "trailingCommas": "none" } } diff --git a/package.json b/package.json index dda9c18..adbc326 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tsshogi/kanna", - "version": "0.0.4", + "version": "0.0.5", "description": "棋譜データをパースするライブラリです", "author": "tkgstrator", "license": "MIT", diff --git a/src/models/square.dto.ts b/src/models/square.dto.ts index d8c5dfc..78a94d7 100644 --- a/src/models/square.dto.ts +++ b/src/models/square.dto.ts @@ -24,8 +24,9 @@ export const Square = z.preprocess( return Piece.OU })(), color: color === 0 ? Color.BLACK : Color.WHITE, - x: x, - y: y, + // x === 0 || y === 0 のときに強制的に持ち駒に変換する + x: y === 0 ? 0 : x, + y: x === 0 ? 0 : y, is_promoted: is_promoted === 2 } }, diff --git a/src/tests/index.spec.ts b/src/tests/index.spec.ts index 8c3b87b..5d53a5d 100644 --- a/src/tests/index.spec.ts +++ b/src/tests/index.spec.ts @@ -8,7 +8,7 @@ import { importTCSV } from '..' describe('math', () => { test('parse', () => { for (const index of Array.from({ length: 100 }, (_, i) => i)) { - if (index === 95 || index === 65 || index === 58) continue + if (index === 95 || index === 65) continue const query = readFileSync(`src/tests/csv/${index}.txt`, { encoding: 'utf8' }) const record: Record | Error = importTCSV(query) if (record instanceof Error) {