From 22083d052eecbbb3cc91a0ab0573915719d72abf Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Wed, 5 Nov 2025 10:33:43 +0100 Subject: [PATCH 1/7] build(typecheck): Add Typescript typecheck on TSX files --- .gitignore | 5 +++++ package.json | 2 ++ tsconfig.app.json | 7 ++++++- tsconfig.node.json | 4 +++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d8125a30..4248c393 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,8 @@ pnpm-debug.log* # Generated/copied files public/data/**/* + +# TypeScript build info +*.tsbuildinfo +tsconfig/*.tsbuildinfo +.tsbuildcache/ diff --git a/package.json b/package.json index 40f3b358..3992ee60 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "lint:watch": "chokidar . --ignore \".git/**\" --ignore \"node_modules/**\" -c \"npm run lint -- --max-warnings=0 && echo '✔ Lint check complete (no errors or warnings)'\"", + "typecheck": "tsc -b", + "typecheck:watch": "tsc -b -w", "format": "prettier --write .", "format:check": "prettier --check .", "format:watch": "chokidar . --ignore \".git/**\" --ignore \"node_modules/**\" -c \"prettier --check .\"", diff --git a/tsconfig.app.json b/tsconfig.app.json index 62793ce4..3d6f5ebd 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -8,7 +8,12 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", - "strict": true + "strict": true, + "composite": true, + "exactOptionalPropertyTypes": true, + "noUncheckedIndexedAccess": true, + "noPropertyAccessFromIndexSignature": true, + "tsBuildInfoFile": ".tsbuildcache/app.tsbuildinfo" }, "include": ["src"] } diff --git a/tsconfig.node.json b/tsconfig.node.json index f3edef58..13a4cb75 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -8,7 +8,9 @@ "isolatedModules": true, "noEmit": true, "strict": true, - "allowSyntheticDefaultImports": true + "allowSyntheticDefaultImports": true, + "composite": true, + "tsBuildInfoFile": ".tsbuildcache/node.tsbuildinfo" }, "include": [ "vite.config.ts", From 028ad1bad2ed75058114c9efacfb43c769409b95 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Wed, 5 Nov 2025 10:34:55 +0100 Subject: [PATCH 2/7] ci(linting): Add `typecheck` check to CI linting workflow --- .github/workflows/node-lint.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/node-lint.yml b/.github/workflows/node-lint.yml index 06e53625..7739c927 100644 --- a/.github/workflows/node-lint.yml +++ b/.github/workflows/node-lint.yml @@ -22,3 +22,24 @@ jobs: - name: Run ESLint run: npm run lint + + typecheck: + name: "Run typecheck" + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: package.json + cache: "npm" + cache-dependency-path: package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Run typecheck + run: npm run typecheck From 808bb823e3d51571c131f3766f9eb161e600ade9 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Thu, 6 Nov 2025 10:05:23 +0100 Subject: [PATCH 3/7] ci(rulesets): Add typecheck to required checks --- .github/rulesets/gitflow-main.json | 4 ++++ .github/rulesets/gitflow-production.json | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/rulesets/gitflow-main.json b/.github/rulesets/gitflow-main.json index 139d7e73..04b367bc 100644 --- a/.github/rulesets/gitflow-main.json +++ b/.github/rulesets/gitflow-main.json @@ -64,6 +64,10 @@ "context": "Linting / Run ESLint", "integration_id": 15368 }, + { + "context": "Linting / Run typecheck", + "integration_id": 15368 + }, { "context": "Unit Tests / Run unit tests", "integration_id": 15368 diff --git a/.github/rulesets/gitflow-production.json b/.github/rulesets/gitflow-production.json index 72d4d511..f5727fdb 100644 --- a/.github/rulesets/gitflow-production.json +++ b/.github/rulesets/gitflow-production.json @@ -64,6 +64,10 @@ "context": "Linting / Run ESLint", "integration_id": 15368 }, + { + "context": "Linting / Run typecheck", + "integration_id": 15368 + }, { "context": "Unit Tests / Run unit tests", "integration_id": 15368 From 6b52ef865fb2c88540b7c5ffd2cd31f9e7f022c8 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Thu, 6 Nov 2025 10:42:48 +0100 Subject: [PATCH 4/7] fix(types): do not include `schema` object in index type --- scripts/build-timeseries-files.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/build-timeseries-files.ts b/scripts/build-timeseries-files.ts index fb0a80fc..a3a7313b 100644 --- a/scripts/build-timeseries-files.ts +++ b/scripts/build-timeseries-files.ts @@ -12,7 +12,7 @@ // - label := label | name // // Output: -// - Writes src/data/index.json with { byPathway, byDataset, schema }. +// - Writes src/data/index.json with { byPathway, byDataset }. import { promises as fs } from "node:fs"; import * as path from "node:path"; @@ -414,7 +414,6 @@ async function main() { export type TimeseriesIndex = { byPathway: Record; byDataset: Record; - schema: { version: number; generatedAt: string }; }; export const index: TimeseriesIndex = ${JSON.stringify(out, null, 2)} as const; export default index; From 90505ac7f2f7a4f646b943c4862326bf13febead Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Thu, 6 Nov 2025 10:43:51 +0100 Subject: [PATCH 5/7] chore(data): regenerate timeseries index --- src/data/index.gen.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/data/index.gen.ts b/src/data/index.gen.ts index 02dd55b7..24c95ed3 100644 --- a/src/data/index.gen.ts +++ b/src/data/index.gen.ts @@ -18,7 +18,6 @@ export type TimeseriesIndex = { summary?: unknown; } >; - schema: { version: number; generatedAt: string }; }; export const index: TimeseriesIndex = { byPathway: { From 3b052de904a37557df6e0513c12085fcfc0e06f9 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Thu, 6 Nov 2025 10:44:14 +0100 Subject: [PATCH 6/7] ci(typescript): Allow node TS config to parse index --- tsconfig.node.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.node.json b/tsconfig.node.json index b574bd84..0a7a234b 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -18,6 +18,7 @@ "vitest.config.ts", "postcss.config.ts", "tailwind.config.ts", - "src/utils/*.ts" + "src/utils/*.ts", + "src/data/index.gen.ts" ] } From 16b53d5d4789094052ad8cc41a68af6c414fd909 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Thu, 6 Nov 2025 10:44:45 +0100 Subject: [PATCH 7/7] test(index): remove `schema` from timeseries index tests --- src/utils/timeseriesIndex.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/timeseriesIndex.test.ts b/src/utils/timeseriesIndex.test.ts index 270fcb31..b485124c 100644 --- a/src/utils/timeseriesIndex.test.ts +++ b/src/utils/timeseriesIndex.test.ts @@ -25,7 +25,6 @@ describe("timeseriesIndex helpers", () => { path: "/data/BAS-2024_timeseries.json", }, }, - schema: { version: 1, generatedAt: new Date().toISOString() }, }; expect(datasetsForPathway(idx, "ACE-BAS-2024")).toEqual([