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 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 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 1d7f5969..2ffeee19 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/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; 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: { 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([ 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 4c78e2b0..0a7a234b 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", @@ -16,6 +18,7 @@ "vitest.config.ts", "postcss.config.ts", "tailwind.config.ts", - "src/utils/*.ts" + "src/utils/*.ts", + "src/data/index.gen.ts" ] }