From d08bb5c82f53bf7cc084ee9ae42046923e3d1e92 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sun, 5 Oct 2025 23:58:50 -0400 Subject: [PATCH] modernize misskey-bubble-game to target the same ES and TS standards as the rest of the app --- packages/misskey-bubble-game/build.js | 2 +- packages/misskey-bubble-game/eslint.config.js | 32 ++++++++--------- packages/misskey-bubble-game/package.json | 7 ++-- packages/misskey-bubble-game/src/index.ts | 2 +- packages/misskey-bubble-game/src/monos.ts | 2 +- .../misskey-bubble-game/tsconfig.game.json | 16 +++++++++ packages/misskey-bubble-game/tsconfig.json | 36 +++---------------- .../misskey-bubble-game/tsconfig.scripts.json | 19 ++++++++++ 8 files changed, 64 insertions(+), 52 deletions(-) create mode 100644 packages/misskey-bubble-game/tsconfig.game.json create mode 100644 packages/misskey-bubble-game/tsconfig.scripts.json diff --git a/packages/misskey-bubble-game/build.js b/packages/misskey-bubble-game/build.js index 93a695e649..9db946ed8d 100644 --- a/packages/misskey-bubble-game/build.js +++ b/packages/misskey-bubble-game/build.js @@ -61,7 +61,7 @@ function buildDts() { return execa( 'tsc', [ - '--project', 'tsconfig.json', + '--project', 'tsconfig.game.json', '--outDir', 'built', '--declaration', 'true', '--emitDeclarationOnly', 'true', diff --git a/packages/misskey-bubble-game/eslint.config.js b/packages/misskey-bubble-game/eslint.config.js index 0b199edf4e..a49a613287 100644 --- a/packages/misskey-bubble-game/eslint.config.js +++ b/packages/misskey-bubble-game/eslint.config.js @@ -6,33 +6,33 @@ export default [ ...sharedConfig, { ignores: [ - '**/node_modules', - 'built', - 'coverage', - 'jest.config.ts', - 'test', - 'test-d', + "**/lib/", + "**/temp/", + "**/built/", + "**/coverage/", + "**/node_modules/", ], }, { - files: ['**/*.ts', '**/*.tsx'], + files: ['src/**/*.ts', 'src/**/*.tsx'], languageOptions: { parserOptions: { parser: tsParser, - project: ['./tsconfig.json'], + project: ['./tsconfig.game.json'], sourceType: 'module', tsconfigRootDir: import.meta.dirname, }, }, }, { - ignores: [ - "**/lib/", - "**/temp/", - "**/built/", - "**/coverage/", - "**/node_modules/", - "*.*", - ] + files: ['*.js', '*.ts'], + languageOptions: { + parserOptions: { + parser: tsParser, + project: ['./tsconfig.scripts.json'], + sourceType: 'module', + tsconfigRootDir: import.meta.dirname, + }, + }, }, ]; diff --git a/packages/misskey-bubble-game/package.json b/packages/misskey-bubble-game/package.json index 19dd29f9c6..73f6067c50 100644 --- a/packages/misskey-bubble-game/package.json +++ b/packages/misskey-bubble-game/package.json @@ -17,8 +17,11 @@ "scripts": { "build": "node ./build.js", "watch": "nodemon -w package.json -e json --exec \"node ./build.js --watch\"", - "eslint": "eslint --quiet \"{src,test,js,@types}/**/*.{js,jsx,ts,tsx,vue}\" --cache", - "typecheck": "tsc --noEmit", + "eslint": "eslint --quiet --cache -c eslint.config.js .", + "typecheck-all": "pnpm run --no-bail typecheck:game && pnpm run --no-bail typecheck:scripts", + "typecheck": "pnpm run typecheck:game && pnpm run typecheck:scripts", + "typecheck:game": "tsc -p tsconfig.game.json --noEmit", + "typecheck:scripts": "tsc -p tsconfig.scripts.json --noEmit", "lint": "pnpm typecheck && pnpm eslint" }, "devDependencies": { diff --git a/packages/misskey-bubble-game/src/index.ts b/packages/misskey-bubble-game/src/index.ts index c5f1f68062..fce32399ec 100644 --- a/packages/misskey-bubble-game/src/index.ts +++ b/packages/misskey-bubble-game/src/index.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { DropAndFusionGame, Mono } from './game.js'; +import { DropAndFusionGame, type Mono } from './game.js'; export { DropAndFusionGame, diff --git a/packages/misskey-bubble-game/src/monos.ts b/packages/misskey-bubble-game/src/monos.ts index 41ab2358c4..c176a2f348 100644 --- a/packages/misskey-bubble-game/src/monos.ts +++ b/packages/misskey-bubble-game/src/monos.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Mono } from './game.js'; +import type { Mono } from './game.js'; const NORMAL_BASE_SIZE = 32; export const NORAML_MONOS: Mono[] = [{ diff --git a/packages/misskey-bubble-game/tsconfig.game.json b/packages/misskey-bubble-game/tsconfig.game.json new file mode 100644 index 0000000000..fb8e5d8594 --- /dev/null +++ b/packages/misskey-bubble-game/tsconfig.game.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../shared/tsconfig.web.json", + "compilerOptions": { + "outDir": "./built/", + "typeRoots": [ + "./node_modules/@types" + ], + }, + "include": [ + "./src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/packages/misskey-bubble-game/tsconfig.json b/packages/misskey-bubble-game/tsconfig.json index 39d541ef5e..c5dc2aa4de 100644 --- a/packages/misskey-bubble-game/tsconfig.json +++ b/packages/misskey-bubble-game/tsconfig.json @@ -1,35 +1,9 @@ { "$schema": "https://json.schemastore.org/tsconfig", - "compilerOptions": { - "target": "ES2022", - "module": "nodenext", - "moduleResolution": "nodenext", - "declaration": true, - "declarationMap": true, - "sourceMap": false, - "outDir": "./built/", - "removeComments": true, - "strict": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "experimentalDecorators": true, - "noImplicitReturns": true, - "esModuleInterop": true, - "skipLibCheck": true, - "incremental": true, - "typeRoots": [ - "./node_modules/@types" - ], - "lib": [ - "esnext", - "dom" - ] - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "node_modules", - "./test/**/*" + "files": [], + // WebStorm only reads one tsconfig per directory, so this tricks it into loading both. + "references": [ + { "path": "./tsconfig.scripts.json" }, + { "path": "./tsconfig.game.json" } ] } diff --git a/packages/misskey-bubble-game/tsconfig.scripts.json b/packages/misskey-bubble-game/tsconfig.scripts.json new file mode 100644 index 0000000000..e001a2139d --- /dev/null +++ b/packages/misskey-bubble-game/tsconfig.scripts.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "../shared/tsconfig.node.json", + "compilerOptions": { + "noImplicitAny": false, + "typeRoots": [ + "./node_modules/@types", + "./node_modules", + "./src/@types" + ] + }, + "include": [ + "*.ts", + "*.js" + ], + "exclude": [ + "node_modules" + ] +}