From 3b122d13fc325535cf19ef740419fa84ef0fcfc4 Mon Sep 17 00:00:00 2001 From: joshunrau Date: Wed, 18 Nov 2026 19:35:59 -0500 Subject: [PATCH 1/2] chore: migrate to oxlint, oxfmt and typescript 7 Replace ESLint with oxlint and Prettier with oxfmt, and move every workspace but apps/outreach from TypeScript 6 to the native TypeScript 7 compiler. Linting. The base rule set and the repo's custom rules move into the new packages/oxlint-config workspace; the custom rules run as an oxlint JS plugin named opendatacapture, so their ids change from odc/ to opendatacapture/. The root oxlint.config.ts extends that config and holds the path-scoped overrides. typescript-eslint is dropped for oxlint's native typescript rules with oxlint-tsgolint; react, jsx-a11y, import and vitest rules are oxlint's own; perfectionist and eslint-plugin-playwright still run, as JS plugins. no-restricted-syntax has no oxlint equivalent: the process.env and axios.create bans become no-restricted-properties entries, and the @RouteAccess check becomes opendatacapture/require-route-access. .astro frontmatter is now linted with the JS and TypeScript rules. Formatting. oxfmt takes over import sorting from perfectionist/sort-imports, and sorts package.json keys and Tailwind classes. The pre-commit hook formats staged files with it; nothing checks formatting in lint or CI. TypeScript. typescript@7 has no classic compiler API, so apps/outreach keeps a TypeScript 6 devDependency for astro check and typedoc, and prisma-json-types-generator is patched to load the API from @typescript/typescript6. libnest moves to 11, whose loader no longer depends on the TypeScript API. The hand-written declarations of runtime-internal and runtime-meta are renamed to types.d.ts, since TypeScript 7 resolves a JSDoc import of ./index.d.ts to the sibling index.js. React's forwardRef is removed from the apps, where ref is a prop under React 19. Co-Authored-By: Claude Fable 5.2 --- .../docs/architecture/auth-and-permissions.md | 4 +- .agents/docs/architecture/testing-strategy.md | 18 +- .agents/docs/index.md | 3 +- .agents/docs/packages/index.md | 12 +- .agents/docs/playbooks/add-e2e-test.md | 4 +- .agents/docs/playbooks/add-env-var.md | 2 +- .agents/docs/playbooks/add-vitest-project.md | 2 +- .../docs/playbooks/promote-to-react-core.md | 2 +- .agents/docs/playbooks/run-locally.md | 2 +- .agents/docs/workspace-map.md | 1 + .agents/skills/finishing-changes/SKILL.md | 2 +- .agents/skills/troubleshooting/SKILL.md | 2 +- .eslint/rules/index.js | 17 - .husky/pre-commit | 13 +- .prettierignore | 8 - AGENTS.md | 10 +- apps/api/AGENTS.md | 8 +- apps/api/package.json | 22 +- .../src/auth/__tests__/auth.service.test.ts | 3 +- .../throttle-login-request.decorator.ts | 4 +- .../instrument-repos.service.ts | 3 +- .../src/mail/__tests__/mail.service.test.ts | 9 +- apps/gateway/AGENTS.md | 2 +- apps/gateway/package.json | 6 +- apps/outreach/AGENTS.md | 7 +- apps/outreach/package.json | 9 +- .../src/components/blog/PostInfoCard.astro | 12 +- .../src/components/common/Headshot.astro | 2 +- .../outreach/src/components/common/Logo.astro | 15 +- .../src/components/common/PageHeading.astro | 4 +- .../src/components/common/Screenshot.astro | 12 +- .../src/components/common/SiteTitle.astro | 4 +- .../components/docs/InstrumentSchemas.astro | 16 +- .../src/components/docs/Licenses.astro | 116 +- .../src/components/icons/MoonIcon.astro | 3 +- .../src/components/icons/SunIcon.astro | 3 +- .../outreach/src/components/layout/Head.astro | 24 +- .../src/components/layout/Header.astro | 22 +- .../components/layout/LanguageToggle.astro | 2 +- .../src/components/layout/ThemeToggle.astro | 4 +- .../src/components/overview/Feature.astro | 18 +- .../src/components/overview/Hero.astro | 12 +- .../src/components/overview/Medical.astro | 671 ++- .../components/overview/Testimonials.astro | 26 +- apps/outreach/src/layouts/Page.astro | 4 +- apps/outreach/src/pages/404.astro | 27 +- .../src/pages/[locale]/blog/[slug].astro | 24 +- .../src/pages/[locale]/blog/index.astro | 91 +- apps/outreach/src/pages/[locale]/faq.astro | 60 +- apps/outreach/src/pages/[locale]/index.astro | 5 +- apps/outreach/src/pages/[locale]/team.astro | 45 +- apps/playground/package.json | 7 +- .../src/components/Command/Command.tsx | 27 +- .../src/components/Command/CommandEmpty.tsx | 11 +- .../src/components/Command/CommandGroup.tsx | 27 +- .../src/components/Command/CommandInput.tsx | 35 +- .../src/components/Command/CommandItem.tsx | 27 +- .../src/components/Command/CommandList.tsx | 17 +- .../ContextMenu/ContextMenuContent.tsx | 35 +- .../ContextMenu/ContextMenuItem.tsx | 31 +- .../src/components/Editor/EditorInput.tsx | 25 +- .../InstrumentSelector/InstrumentSelector.tsx | 6 +- apps/playground/src/preview/protocol.ts | 3 +- .../playground/src/typings/monaco-editor.d.ts | 2 +- apps/web/AGENTS.md | 14 +- apps/web/package.json | 6 +- .../InstrumentShowcase.stories.tsx | 11 +- .../src/components/NavButton/NavButton.tsx | 20 +- .../__tests__/useInstrumentInfoById.test.ts | 3 +- .../useSubjectDemographicsLookup.test.ts | 3 +- .../__tests__/WalkthroughProvider.test.tsx | 24 +- .../session/__tests__/start-session.test.tsx | 27 +- apps/web/src/routes/auth/login.tsx | 5 +- .../src/utils/__tests__/chart-palette.test.ts | 2 +- apps/web/src/utils/collected-filter.ts | 9 +- docs/en/5-reference/5.2-tooling.md | 4 +- eslint.config.js | 380 -- knip.ts | 8 +- oxfmt.config.ts | 41 + oxlint.config.ts | 217 + package.json | 46 +- packages/demo/package.json | 8 +- packages/instrument-bundler/package.json | 30 +- packages/instrument-guidelines/AGENTS.md | 9 +- packages/instrument-guidelines/package.json | 34 +- packages/instrument-interpreter/package.json | 8 +- packages/instrument-library/AGENTS.md | 4 +- packages/instrument-library/package.json | 8 +- packages/instrument-stubs/AGENTS.md | 8 +- packages/instrument-stubs/package.json | 14 +- packages/instrument-utils/package.json | 8 +- packages/licenses/package.json | 8 +- packages/oxlint-config/AGENTS.md | 52 + packages/oxlint-config/CLAUDE.md | 1 + packages/oxlint-config/package.json | 22 + .../oxlint-config/src/__tests__/index.test.ts | 37 + .../src/__tests__/plugin.test.ts | 28 + packages/oxlint-config/src/index.js | 447 ++ packages/oxlint-config/src/plugin.js | 33 + .../__tests__/class-name-composition.test.ts | 25 + .../src/rules/__tests__/handler-names.test.ts | 40 + .../__tests__/multiline-arrow-body.test.ts | 36 + .../__tests__/no-coverage-ignore.test.ts | 13 + .../__tests__/require-disable-reason.test.ts | 24 + .../__tests__/require-route-access.test.ts | 18 + .../src/rules/__tests__/route-exports.test.ts | 21 + .../src/rules/__tests__/rule-tester.ts | 9 + .../test-tooling-in-tests-folder.test.ts | 25 + .../__tests__/unit-test-names-subject.test.ts | 36 + .../rules/__tests__/unit-test-subject.test.ts | 54 + .../src}/rules/class-name-composition.js | 6 +- .../oxlint-config/src}/rules/handler-names.js | 12 +- .../src}/rules/multiline-arrow-body.js | 4 +- .../src}/rules/no-coverage-ignore.js | 4 +- .../src}/rules/require-disable-reason.js | 9 +- .../src/rules/require-route-access.js | 23 + .../oxlint-config/src}/rules/route-exports.js | 7 +- .../src/rules/test-tooling-in-tests-folder.js | 29 + .../src/rules/unit-test-names-subject.js | 44 + .../src}/rules/unit-test-subject.js | 29 +- packages/oxlint-config/tsconfig.json | 4 + packages/oxlint-config/vitest.config.ts | 13 + packages/playground-url/package.json | 24 +- packages/react-core/AGENTS.md | 4 +- packages/react-core/package.json | 22 +- .../FileInstrumentContent/Dropzone.tsx | 1 + .../UploadProgressBar.tsx | 1 + .../components/InstrumentRenderer/types.ts | 4 +- .../InteractiveContent/InteractiveContent.tsx | 2 + .../NavigationBlockerDialog.tsx | 1 + .../src/hooks/useInterpretedInstrument.ts | 7 +- packages/release-info/package.json | 8 +- packages/runtime-bundler/package.json | 14 +- .../test/fixtures/classic-script/package.json | 2 +- .../test/fixtures/shared-state/package.json | 2 +- .../test/fixtures/state-writer/package.json | 2 +- packages/runtime-core/package.json | 24 +- .../runtime-core/src/types/instrument.base.ts | 3 +- .../runtime-core/src/types/instrument.core.ts | 4 +- .../runtime-core/src/types/instrument.form.ts | 6 +- .../src/types/instrument.series.ts | 3 +- packages/runtime-internal/AGENTS.md | 8 +- packages/runtime-internal/package.json | 12 +- packages/runtime-internal/src/index.js | 8 +- .../src/{index.d.ts => types.d.ts} | 0 packages/runtime-meta/AGENTS.md | 6 +- packages/runtime-meta/package.json | 10 +- packages/runtime-meta/src/index.js | 16 +- .../src/{index.d.ts => types.d.ts} | 0 packages/schemas/AGENTS.md | 4 +- packages/schemas/package.json | 8 +- packages/serve-instrument/package.json | 18 +- packages/subject-utils/package.json | 8 +- packages/vite-plugin-runtime/package.json | 14 +- .../prisma-json-types-generator@3.6.2.patch | 65 + pnpm-lock.yaml | 3601 ++++++----------- pnpm-workspace.yaml | 35 +- prettier.config.js | 6 - runtime/v1/package.json | 28 +- scripts/changelog.ts | 5 +- scripts/format.ts | 11 + scripts/increment-version.ts | 5 +- storybook/AGENTS.md | 6 +- storybook/package.json | 6 +- testing/AGENTS.md | 2 +- testing/package.json | 4 +- .../pages/_app/datahub/subjects/index.page.ts | 9 +- tsconfig.json | 2 + turbo.json | 8 +- vendor/AGENTS.md | 2 +- 170 files changed, 3762 insertions(+), 3993 deletions(-) delete mode 100644 .eslint/rules/index.js delete mode 100644 .prettierignore delete mode 100644 eslint.config.js create mode 100644 oxfmt.config.ts create mode 100644 oxlint.config.ts create mode 100644 packages/oxlint-config/AGENTS.md create mode 120000 packages/oxlint-config/CLAUDE.md create mode 100644 packages/oxlint-config/package.json create mode 100644 packages/oxlint-config/src/__tests__/index.test.ts create mode 100644 packages/oxlint-config/src/__tests__/plugin.test.ts create mode 100644 packages/oxlint-config/src/index.js create mode 100644 packages/oxlint-config/src/plugin.js create mode 100644 packages/oxlint-config/src/rules/__tests__/class-name-composition.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/handler-names.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/multiline-arrow-body.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/no-coverage-ignore.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/require-disable-reason.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/require-route-access.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/route-exports.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/rule-tester.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/test-tooling-in-tests-folder.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/unit-test-names-subject.test.ts create mode 100644 packages/oxlint-config/src/rules/__tests__/unit-test-subject.test.ts rename {.eslint => packages/oxlint-config/src}/rules/class-name-composition.js (90%) rename {.eslint => packages/oxlint-config/src}/rules/handler-names.js (76%) rename {.eslint => packages/oxlint-config/src}/rules/multiline-arrow-body.js (94%) rename {.eslint => packages/oxlint-config/src}/rules/no-coverage-ignore.js (88%) rename {.eslint => packages/oxlint-config/src}/rules/require-disable-reason.js (71%) create mode 100644 packages/oxlint-config/src/rules/require-route-access.js rename {.eslint => packages/oxlint-config/src}/rules/route-exports.js (88%) create mode 100644 packages/oxlint-config/src/rules/test-tooling-in-tests-folder.js create mode 100644 packages/oxlint-config/src/rules/unit-test-names-subject.js rename {.eslint => packages/oxlint-config/src}/rules/unit-test-subject.js (80%) create mode 100644 packages/oxlint-config/tsconfig.json create mode 100644 packages/oxlint-config/vitest.config.ts rename packages/runtime-internal/src/{index.d.ts => types.d.ts} (100%) rename packages/runtime-meta/src/{index.d.ts => types.d.ts} (100%) create mode 100644 patches/prisma-json-types-generator@3.6.2.patch delete mode 100644 prettier.config.js create mode 100644 scripts/format.ts diff --git a/.agents/docs/architecture/auth-and-permissions.md b/.agents/docs/architecture/auth-and-permissions.md index 89004cc3b2..3a2c7278af 100644 --- a/.agents/docs/architecture/auth-and-permissions.md +++ b/.agents/docs/architecture/auth-and-permissions.md @@ -15,8 +15,8 @@ that they may read _some_ subject; the `where` decides whether they may read _th ## Layer 1: `@RouteAccess` -`REQUIRE_ROUTE_ACCESS` in the root `eslint.config.js` flags a handler without one; the guard turns a -missing one into a 500. Nothing checks the value. Routes whose declaration is not the ordinary +`opendatacapture/require-route-access` (`packages/oxlint-config/src/rules/`) flags a handler without +one; the guard turns a missing one into a 500. Nothing checks the value. Routes whose declaration is not the ordinary `{ action, subject }` on the model they serve: | Route | Declaration | Why it is safe | diff --git a/.agents/docs/architecture/testing-strategy.md b/.agents/docs/architecture/testing-strategy.md index 3c9bab04e6..0a0552a0d9 100644 --- a/.agents/docs/architecture/testing-strategy.md +++ b/.agents/docs/architecture/testing-strategy.md @@ -34,7 +34,7 @@ project. Before trusting a new test, see it listed and watch it fail on purpose. ## Vitest projects -Twenty-two, each named after its directory except `runtime/v1` (`runtime-v1`) and `.github` (`github`). Quirks of each live in +Twenty-three, each named after its directory except `runtime/v1` (`runtime-v1`) and `.github` (`github`). Quirks of each live in that package's `AGENTS.md` §Tests. Three run under happy-dom; the rest run in node, where one file opts into a DOM with a first-line `// @vitest-environment happy-dom` docblock. @@ -50,6 +50,7 @@ opts into a DOM with a first-line `// @vitest-environment happy-dom` docblock. | `instrument-library` | `packages/instrument-library` | happy-dom; aliases `/runtime/v1/…` to sources, no build | | `instrument-stubs` | `packages/instrument-stubs` | tests are `.test.js` | | `instrument-utils` | `packages/instrument-utils` | | +| `oxlint-config` | `packages/oxlint-config` | `RuleTester` from `oxlint/plugins-dev` | | `playground-url` | `packages/playground-url` | | | `react-core` | `packages/react-core` | happy-dom | | `release-info` | `packages/release-info` | | @@ -91,15 +92,15 @@ outside the project globs by design. ## `pnpm lint` is the type-check, and it edits files -Per-package `lint` is `tsc && eslint --fix src`; there is no separate `typecheck` script, so a type +Per-package `lint` is `tsc && oxlint --fix src`; there is no separate `typecheck` script, so a type error surfaces as a lint failure and every run may rewrite the working tree. Exceptions: | Package | `lint` | | ------------------------------------------------------------- | ------------------------------------------ | -| `apps/outreach` | `astro check && eslint --fix src` | -| `packages/runtime-core` | `tsc --noEmit && eslint --fix src` | -| `packages/instrument-stubs`, `packages/instrument-guidelines` | eslint only — **no `tsc`** | -| `testing` | `pnpm gen:routes && tsc && eslint --fix .` | +| `apps/outreach` | `astro check && oxlint --fix src` | +| `packages/runtime-core` | `tsc --noEmit && oxlint --fix src` | +| `packages/instrument-stubs`, `packages/instrument-guidelines` | oxlint only — **no `tsc`** | +| `testing` | `pnpm gen:routes && tsc && oxlint --fix .` | | `runtime/v1` | **none**, so never type-checked | ## Turbo task graph @@ -107,7 +108,8 @@ error surfaces as a lint failure and every run may rewrite the working tree. Exc `lint`, `dev`, `dev:test` and `test:e2e` depend on `["^build", "^db:generate", "db:push"]`; `build` on `["^build", "db:generate"]`. `test:e2e` is `cache: false`. **`test` is not a turbo task**: root `pnpm test` is `env-cmd vitest`, with no build and no database. `globalDependencies` (`.env`, -`eslint.config.js`, `tsconfig.json`, `prettier.config.js`) invalidate every cached task when touched. +`oxfmt.config.ts`, `oxlint.config.ts`, `packages/oxlint-config/src/**`, `tsconfig.json`) invalidate +every cached task when touched. ## Coverage scope @@ -124,7 +126,7 @@ counts their functions twice in the merged report. `pnpm lint`, `pnpm test:coverage`, Playwright install (chromium + firefox, capped at 10 minutes, after lint and unit tests so a hung download cannot hide them), `pnpm test:e2e`. -Not gated: knip (`pnpm knip` exists), and formatting — prettier runs only in the `.husky/pre-commit` +Not gated: knip (`pnpm knip` exists), and formatting — oxfmt runs only in the `.husky/pre-commit` hook, which formats rather than verifies. `.github/workflows/release.yaml` (push to `main`, dispatch on `release/`) validates with `pnpm lint` only — **no unit or e2e diff --git a/.agents/docs/index.md b/.agents/docs/index.md index 94381e2b3f..2e4247adba 100644 --- a/.agents/docs/index.md +++ b/.agents/docs/index.md @@ -15,6 +15,7 @@ Read the `AGENTS.md` in the directory you are editing; each covers only that wor | Building the library catalog instruments import | `packages/runtime-bundler/AGENTS.md` | | The `defineInstrument` public API | `packages/runtime-core/AGENTS.md` | | Adding or editing a built-in instrument | `packages/instrument-library/AGENTS.md` | +| Lint rules and the custom oxlint plugin | `packages/oxlint-config/AGENTS.md` | | Pinned library wrappers instruments import | `vendor/AGENTS.md` | | The published runtime artifact | `runtime/v1/AGENTS.md` | | End-to-end tests | `testing/AGENTS.md` | @@ -33,7 +34,7 @@ isn't one. | Topic | Path | | --------------------------------------------------------------- | --------------------------------------------------- | | Which workspace depends on which, what is built, what publishes | `.agents/docs/workspace-map.md` | -| The 11 `@douglasneuroinformatics/*` packages this repo consumes | `.agents/docs/packages/index.md` | +| The 9 `@douglasneuroinformatics/*` packages this repo consumes | `.agents/docs/packages/index.md` | | Instrument source → bundle → store → interpret → render | `.agents/docs/architecture/instrument-pipeline.md` | | The six similarly-named `runtime-*` things, and `vendor/` | `.agents/docs/architecture/runtime-and-vendor.md` | | CASL, `@RouteAccess`, and group scoping | `.agents/docs/architecture/auth-and-permissions.md` | diff --git a/.agents/docs/packages/index.md b/.agents/docs/packages/index.md index 22c3be7a88..d531b90a50 100644 --- a/.agents/docs/packages/index.md +++ b/.agents/docs/packages/index.md @@ -1,6 +1,6 @@ # Internal DNP packages -The 11 `@douglasneuroinformatics/*` packages, maintained in separate repos. Use this file to find +The 9 `@douglasneuroinformatics/*` packages, maintained in separate repos. Use this file to find which one already does what you need, then read that package's source for the API. This file does not copy APIs, because copies drift. @@ -13,21 +13,19 @@ not copy APIs, because copies drift. | `libui-form-types` | the `FormTypes` declarative-form types. Instrument code uses runtime-core's `FormInstrument` types, which wrap these | runtime-core, and libui's `Form` | | `libnest` | the Nest layer of `apps/api`: bootstrap, config, Prisma models, validation pipes, logging, crypto, virtualization, test doubles (`./testing`). `apps/api/AGENTS.md` covers how the app uses it | api | | `libui` | React/Tailwind components, hooks (`useTranslation`, `useNotificationsStore`, …), `cn`, i18n, `CoreProvider`. It has no root export: import `./components`, `./hooks`, `./utils`, `./i18n`, `./providers` or `./tailwind/globals.css` | web, gateway, playground, outreach, react-core, serve-instrument | -| `eslint-config` | the `config()` factory behind the root `eslint.config.js` | root | -| `prettier-config` | `createConfig()` behind the root `prettier.config.js`, and the `prettier-pre-commit` bin that `.husky/pre-commit` runs | root | | `tsconfig` | the base that the root `tsconfig.json` extends. It sets `noEmit: true`, so the `tsc` in every `lint` script only typechecks | root | | `esbuild-plugin-prisma` | `prismaPlugin({ outdir })`, which copies Prisma's query engine next to an esbuild bundle | gateway's `scripts/build.ts` | ## Reading the source -Resolve a package through a workspace in its "Used in" column. Only `eslint-config`, -`prettier-config` and `tsconfig` are linked at the repo root. For example: +Resolve a package through a workspace in its "Used in" column. Only `tsconfig` is +linked at the repo root. For example: `apps/api/node_modules/@douglasneuroinformatics/libnest/src/index.ts`. - `libnest`, `libui`, `libcrypto`, `libpasswd`: original TypeScript under `src/`. -- `prettier-config`, `esbuild-plugin-prisma`: JSDoc-typed `.js` under `src/`, plus a hand-written +- `esbuild-plugin-prisma`: JSDoc-typed `.js` under `src/`, plus a hand-written `.d.ts`. -- `libjs`, `eslint-config`: `dist/` only, but unbundled and unminified with JSDoc intact, one file +- `libjs`: `dist/` only, but unbundled and unminified with JSDoc intact, one file per module. - `libui-form-types`, `tsconfig`: the published file is the whole package (`lib/index.d.ts`, `tsconfig.json`). diff --git a/.agents/docs/playbooks/add-e2e-test.md b/.agents/docs/playbooks/add-e2e-test.md index c2b48fa146..0bbf1b5618 100644 --- a/.agents/docs/playbooks/add-e2e-test.md +++ b/.agents/docs/playbooks/add-e2e-test.md @@ -23,7 +23,7 @@ starting — `playwright.config.ts` boots api, gateway, web and playground itsel 4. **Register it in `pageModels` in `testing/src/support/fixtures.ts`** if the spec navigates to it with `getPageModel`, keyed by the route literal — `'/datahub/subjects/$subjectId/assignments': -SubjectAssignmentsPage`. A page reached by clicking through needs no entry; use `new XPage(page)`. + SubjectAssignmentsPage`. A page reached by clicking through needs no entry; use `new XPage(page)`. 5. **Write the spec** at `testing/src/specs/.spec.ts`, importing `import { expect, test } from '../support/fixtures';`. With the raw `@playwright/test` import, a @@ -44,7 +44,7 @@ SubjectAssignmentsPage`. A page reached by clicking through needs no entry; use ## Verify ```sh -pnpm --filter @opendatacapture/testing lint # gen:routes, tsc, eslint . +pnpm --filter @opendatacapture/testing lint # gen:routes, tsc, oxlint . pnpm --filter @opendatacapture/testing test:e2e --list src/specs/.spec.ts # your titles, under [chromium] pnpm --filter @opendatacapture/testing test:e2e src/specs/.spec.ts # one spec; setup still runs pnpm test:e2e # whole suite, from repo root diff --git a/.agents/docs/playbooks/add-env-var.md b/.agents/docs/playbooks/add-env-var.md index 6aabef96f7..84ebb9503e 100644 --- a/.agents/docs/playbooks/add-env-var.md +++ b/.agents/docs/playbooks/add-env-var.md @@ -32,7 +32,7 @@ or give it a `.default()`. A cross-field requirement goes in the `.transform((env, ctx) => ...)` at the bottom of `$Env` via `ctx.addIssue`; the `STORAGE_ENABLED` block is the pattern. -5. **Read it as `this.configService.get('YOUR_KEY')`.** `process.env` is an eslint error in +5. **Read it as `this.configService.get('YOUR_KEY')`.** `process.env` is an oxlint error in `apps/api/src`; do not add a second exception to `src/core/decorators/throttle-login-request.decorator.ts`. To gate a whole module on a boolean, use `{ module: XModule, when: 'YOUR_KEY' }` in the `imports` array of `apps/api/src/main.ts`. diff --git a/.agents/docs/playbooks/add-vitest-project.md b/.agents/docs/playbooks/add-vitest-project.md index 1c56500a54..a5b6e50109 100644 --- a/.agents/docs/playbooks/add-vitest-project.md +++ b/.agents/docs/playbooks/add-vitest-project.md @@ -46,7 +46,7 @@ project, so its test files are collected by nothing and CI stays green. The loud devDependency — ask first per the root rule, then `pnpm install`. Redeclare under `resolve.alias` any alias the source imports; `vite.config.ts` is not loaded during tests. -5. **Add `vitest.config.ts` to the package's `tsconfig.json` `include`.** Package eslint runs on `src` +5. **Add `vitest.config.ts` to the package's `tsconfig.json` `include`.** Package oxlint runs on `src` only, so `tsc` is the config's only check. Tests in `test/` rather than `src/` need `test/**/*.ts` there too (`packages/runtime-bundler`), or nothing type-checks them. diff --git a/.agents/docs/playbooks/promote-to-react-core.md b/.agents/docs/playbooks/promote-to-react-core.md index 243be69010..6cffd9cd53 100644 --- a/.agents/docs/playbooks/promote-to-react-core.md +++ b/.agents/docs/playbooks/promote-to-react-core.md @@ -39,7 +39,7 @@ done; `apps/web`'s until step 9. 6. **Repoint every `@/…` import.** react-core has no `@` alias, and neither does Storybook for files here. `@/components/*` becomes a relative sibling import; `@/store`, `@/hooks/*`, `@/config`, `@/services/*` and `@/utils/*` become props per step 5. A relative path climbing into - `apps/web/src` typechecks and no eslint rule forbids it — nothing under `src/` may resolve outside + `apps/web/src` typechecks and no oxlint rule forbids it — nothing under `src/` may resolve outside the package. 7. **Declare every remaining bare import in `packages/react-core/package.json`** (`@heroicons/react`, diff --git a/.agents/docs/playbooks/run-locally.md b/.agents/docs/playbooks/run-locally.md index 844b4f0a2a..50a9a28913 100644 --- a/.agents/docs/playbooks/run-locally.md +++ b/.agents/docs/playbooks/run-locally.md @@ -51,7 +51,7 @@ one. Done when `rs.status().ok` returns 1. 6. **`pnpm install`.** It also installs the husky pre-commit hook, which formats staged files with - prettier and runs neither lint nor tests. + oxfmt and runs neither lint nor tests. 7. **Run `pnpm build` once.** `runtime/v1/dist` is gitignored and read while Vite configs load, so a dev server started without it dies with diff --git a/.agents/docs/workspace-map.md b/.agents/docs/workspace-map.md index 68c20d340b..efa0a47bca 100644 --- a/.agents/docs/workspace-map.md +++ b/.agents/docs/workspace-map.md @@ -22,6 +22,7 @@ The five `apps/*`, `storybook` and `testing` are leaves: no workspace depends on | `instrument-stubs` | Minimal stub instruments for tests | react-core, schemas, web | | `instrument-utils` | Helpers for working with instrument definitions | api, react-core, web | | `licenses` | SPDX and custom license metadata | outreach, runtime-core, runtime-v1, schemas, web | +| `oxlint-config` | The base oxlint config and the repo's custom-rule plugin (`opendatacapture/*`) | root `oxlint.config.ts` | | `playground-url` | Encodes and decodes shareable playground URLs | playground, testing | | `react-core` | Components and hooks shared by more than one frontend | gateway, playground, serve-instrument, storybook, web | | `release-info` | Resolves version, branch and commit at build time | api, gateway, web | diff --git a/.agents/skills/finishing-changes/SKILL.md b/.agents/skills/finishing-changes/SKILL.md index aa96f62640..bc87b00c74 100644 --- a/.agents/skills/finishing-changes/SKILL.md +++ b/.agents/skills/finishing-changes/SKILL.md @@ -22,7 +22,7 @@ for unit tests). A diff spanning rows runs each row's checks; any other file mea `pnpm lint`, `pnpm test:coverage` and `pnpm test:e2e` in sequence, so a lint failure hides the rest until it is fixed. `pnpm test:e2e` needs its browsers installed once per machine (`.agents/docs/playbooks/add-e2e-test.md`). -2. **After it, read `git status`.** `eslint --fix` rewrites as it checks; the rewrites are your own code being +2. **After it, read `git status`.** `oxlint --fix` rewrites as it checks; the rewrites are your own code being sorted, so keep them. TS2345 on a route literal you added is an exception until the user regenerates `route-tree.ts` (`.agents/docs/playbooks/add-web-route.md`); revert any `route-tree.ts` diff. Because that failure stops `pnpm check` at lint, run `pnpm test:coverage` directly and leave `pnpm test:e2e` for after diff --git a/.agents/skills/troubleshooting/SKILL.md b/.agents/skills/troubleshooting/SKILL.md index 7b638419cf..d8be485ef6 100644 --- a/.agents/skills/troubleshooting/SKILL.md +++ b/.agents/skills/troubleshooting/SKILL.md @@ -12,7 +12,7 @@ that is deliberately left alone is recorded in the owning workspace's `AGENTS.md - **TS2345 on a route literal you just added** is expected until the user regenerates `route-tree.ts` (`.agents/docs/playbooks/add-web-route.md`). Every Vite run in `apps/web` (`dev`, `dev:test`, the Playwright webServer, `vite build`) rewrites that tracked file; if `git status` shows it after a debugging run, revert it. -- **`pnpm lint` passed and the tree changed**: `eslint --fix` sorted your new code. Keep the rewrite. +- **`pnpm lint` passed and the tree changed**: `oxlint --fix` sorted your new code. Keep the rewrite. - **`Failed to find .env file at default paths`**: run `pnpm generate:env` (root `AGENTS.md`). - **ENOENT while a Vite config resolves, or `/runtime/v1/*` unresolved**: `runtime/v1/dist` is unbuilt. Turbo builds it; a bare `tsc`, `vitest` or storybook does not (`.agents/docs/playbooks/run-locally.md`). diff --git a/.eslint/rules/index.js b/.eslint/rules/index.js deleted file mode 100644 index 754a2e2401..0000000000 --- a/.eslint/rules/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import { classNameComposition } from './class-name-composition.js'; -import { handlerNames } from './handler-names.js'; -import { multilineArrowBody } from './multiline-arrow-body.js'; -import { noCoverageIgnore } from './no-coverage-ignore.js'; -import { requireDisableReason } from './require-disable-reason.js'; -import { routeExports } from './route-exports.js'; -import { unitTestSubject } from './unit-test-subject.js'; - -export const rules = { - 'class-name-composition': classNameComposition, - 'handler-names': handlerNames, - 'multiline-arrow-body': multilineArrowBody, - 'no-coverage-ignore': noCoverageIgnore, - 'require-disable-reason': requireDisableReason, - 'route-exports': routeExports, - 'unit-test-subject': unitTestSubject -}; diff --git a/.husky/pre-commit b/.husky/pre-commit index b956e64695..497616f4ff 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,12 @@ -prettier-pre-commit +STAGED_FILES=$(mktemp) +trap 'rm -f "$STAGED_FILES"' EXIT + +git diff --cached --name-only --diff-filter=ACMR -z > "$STAGED_FILES" + +# Given no path, oxfmt formats the whole working directory +[ -s "$STAGED_FILES" ] || exit 0 + +xargs -0 pnpm exec oxfmt --no-error-on-unmatched-pattern < "$STAGED_FILES" + +# Add the formatted files back to staging +xargs -0 git add < "$STAGED_FILES" diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 71d1ecaa76..0000000000 --- a/.prettierignore +++ /dev/null @@ -1,8 +0,0 @@ -# Add files here to ignore them from prettier formatting - -/dist -/coverage -.claude/skills -apps/web/src/route-tree.ts -# Regenerated by pnpm on every install; formatting it just churns the diff -pnpm-lock.yaml \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index dc06b835ca..f3c36e8c44 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # Open Data Capture An electronic data capture platform for administering remote and in-person clinical instruments. -It is a pnpm/Turborepo monorepo written in TypeScript: 27 first-party workspaces under `apps/`, +It is a pnpm/Turborepo monorepo written in TypeScript: 28 first-party workspaces under `apps/`, `packages/`, `runtime/`, `storybook/` and `testing/`, plus 38 thin version-pinned wrappers under `vendor/` that are also workspaces. @@ -18,8 +18,8 @@ pnpm install # install deps pnpm generate:env # create .env from .env.template — required before anything else runs pnpm dev # run core apps (api, gateway, web) via turbo pnpm build # turbo build (all packages/apps) -pnpm lint # turbo lint — `tsc && eslint --fix src` per package, plus lint:root for root-level scripts and configs -pnpm format # turbo format (prettier per package) +pnpm lint # turbo lint — `tsc && oxlint --fix src` per package, plus lint:root for root-level scripts and configs +pnpm format # turbo format (oxfmt per package) pnpm test # vitest across the workspace pnpm test:coverage # vitest with coverage — fails below 100%, the gate CI runs pnpm test:e2e # playwright, in testing/ @@ -87,8 +87,8 @@ Outside call sites, an assertion the lint flags (`as`, `!`) is allowed only when Advanced type-level constructs (e.g., conditional types, template literal types, inference extraction, mapped types) are a routine tool. **Tests.** A unit test is `.test.ts(x)` in a `__tests__/` folder beside the file it tests, or -in a package's `test/` folder when it drives the whole package; eslint enforces the layout -(`odc/unit-test-subject` in `.eslint/rules/`, beside the repo's other custom rules). Keep test +in a package's `test/` folder when it drives the whole package; oxlint enforces the layout +(`opendatacapture/unit-test-subject` in `packages/oxlint-config/src/rules/`, beside the repo's other custom rules). Keep test bodies short; each verifies one behavior. Descriptions are concise, grammatical sentences stating the behavioral reason, e.g. `'should key the cache on every parameter, so paging does not serve a stale page'`. diff --git a/apps/api/AGENTS.md b/apps/api/AGENTS.md index 20c76af783..1609cd81e9 100644 --- a/apps/api/AGENTS.md +++ b/apps/api/AGENTS.md @@ -45,7 +45,7 @@ src// There is no repository layer and no `entity/` folder — `Model<'X'>` _is_ the repository. **A single-segment route can be shadowed by a `:param` route on the same verb.** `perfectionist/sort-classes` -is an eslint error, so `eslint --fix` orders controller handlers alphabetically — a handler you wrote +is an oxlint error, so `oxlint --fix` orders controller handlers alphabetically — a handler you wrote above `@Get(':id')` does not stay there. Anything that sorts below it, such as a hypothetical `@Get('summary')` in `users.controller.ts`, is matched by `:id` instead, and the failure is a confusing 404 or cast error rather than a lint or type failure. Give such a route two segments so @@ -64,7 +64,7 @@ check _which rows_. **1. Every handler needs `@RouteAccess`.** A handler without one throws `InternalServerErrorException` at request time — so the failure mode is a 500, not an accidentally -public route. This is eslint-enforced. Know what you are choosing: +public route. This is oxlint-enforced. Know what you are choosing: | Value | Means | | ----------------------------------- | --------------------------------------------------------------------------------------------- | @@ -98,7 +98,7 @@ off it, and its controller forwards `@CurrentUser()` — `src/instruments/instru `accessibleQuery(undefined, ...)` returns `{}` — **an omitted or undefined ability means no restriction**, which reads clinical data across every group. Nothing catches this: not `tsc`, not -eslint, not a passing test suite. It is the single highest-severity mistake available in this +oxlint, not a passing test suite. It is the single highest-severity mistake available in this codebase, so verify the `where` clause of any query you add or edit. The defined case has the opposite failure mode: **an ability holding no rule at all for the queried @@ -220,7 +220,7 @@ in one and not the other type-checks on both sides and fails when a document is ## Configuration All environment variables are declared in `$Env` (`src/core/schemas/env.schema.ts`) and read through -`ConfigService`. **Reading `process.env` directly is an eslint error** — the one exception is +`ConfigService`. **Reading `process.env` directly is an oxlint error** — the one exception is `src/core/decorators/throttle-login-request.decorator.ts`, where decorator arguments are evaluated before the DI container exists. diff --git a/apps/api/package.json b/apps/api/package.json index 3af58c4c66..9e3d601dca 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -1,16 +1,22 @@ { "name": "@opendatacapture/api", - "type": "module", "version": "0.0.0", "private": true, "license": "Apache-2.0", + "type": "module", + "imports": { + "#runtime/v1/*": { + "development": "../../runtime/v1/dist/*", + "default": "./dist/runtime/v1/*" + } + }, "scripts": { "build": "rm -rf dist && NODE_ENV=production libnest build -c libnest.config.ts", "db:generate": "prisma generate --no-hints", "dev": "NODE_ENV=development NODE_OPTIONS='--conditions=development' env-cmd -f ../../.env libnest dev -c libnest.config.ts", "dev:test": "NODE_ENV=test env-cmd -f ../../.env env STORAGE_ENABLED=true libnest dev -c libnest.config.ts --no-watch", - "format": "prettier --write src test", - "lint": "tsc && eslint --fix src test", + "format": "oxfmt src test", + "lint": "tsc && oxlint --fix src test", "start": "NODE_ENV=production env-cmd -f ../../.env node dist/app.js", "test": "env-cmd -f ../../.env vitest" }, @@ -21,7 +27,7 @@ "@casl/prisma": "^2.0.2", "@douglasneuroinformatics/libcrypto": "catalog:", "@douglasneuroinformatics/libjs": "catalog:", - "@douglasneuroinformatics/libnest": "^10.0.0", + "@douglasneuroinformatics/libnest": "^11.0.0", "@douglasneuroinformatics/libpasswd": "catalog:", "@douglasneuroinformatics/libstats": "catalog:", "@faker-js/faker": "^10.6.0", @@ -65,12 +71,6 @@ "@types/passport-jwt": "^4.0.1", "mongodb-memory-server": "^11.3.0", "prisma": "catalog:", - "prisma-json-types-generator": "^3.2.2" - }, - "imports": { - "#runtime/v1/*": { - "development": "../../runtime/v1/dist/*", - "default": "./dist/runtime/v1/*" - } + "prisma-json-types-generator": "catalog:" } } diff --git a/apps/api/src/auth/__tests__/auth.service.test.ts b/apps/api/src/auth/__tests__/auth.service.test.ts index 4077d937a2..70aa8020e5 100644 --- a/apps/api/src/auth/__tests__/auth.service.test.ts +++ b/apps/api/src/auth/__tests__/auth.service.test.ts @@ -45,7 +45,8 @@ describe('AuthService', () => { /** The permissions the minted token actually carries, read back off the signed payload. */ const mintedPermissions = async (currentUser: RequestUser): Promise => { await authService.getCreateInstrumentToken(currentUser); - return (jwtService.signAsync.mock.lastCall?.[0] as { permissions: Permission[] }).permissions; + const [payload] = jwtService.signAsync.mock.lastCall ?? []; + return (payload as { permissions: Permission[] }).permissions; }; beforeEach(() => { diff --git a/apps/api/src/core/decorators/throttle-login-request.decorator.ts b/apps/api/src/core/decorators/throttle-login-request.decorator.ts index 7a744400ee..c15732f941 100644 --- a/apps/api/src/core/decorators/throttle-login-request.decorator.ts +++ b/apps/api/src/core/decorators/throttle-login-request.decorator.ts @@ -11,13 +11,13 @@ import { DEFAULT_LOGIN_REQUEST_THROTTLER_LIMIT, DEFAULT_LOGIN_REQUEST_THROTTLER_ const LOGIN_REQUEST_THROTTLER_LIMIT = $NumberLike .pipe(z.number().int().positive()) .default(DEFAULT_LOGIN_REQUEST_THROTTLER_LIMIT) - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, no-restricted-syntax -- ConfigService does not exist when decorator arguments are evaluated, and || maps an empty variable to the default + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, no-restricted-properties -- ConfigService does not exist when decorator arguments are evaluated, and || maps an empty variable to the default .parse(process.env.LOGIN_REQUEST_THROTTLER_LIMIT || undefined); const LOGIN_REQUEST_THROTTLER_TTL = $NumberLike .pipe(z.number().int().positive()) .default(DEFAULT_LOGIN_REQUEST_THROTTLER_TTL) - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, no-restricted-syntax -- ConfigService does not exist when decorator arguments are evaluated, and || maps an empty variable to the default + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, no-restricted-properties -- ConfigService does not exist when decorator arguments are evaluated, and || maps an empty variable to the default .parse(process.env.LOGIN_REQUEST_THROTTLER_TTL || undefined); export function ThrottleLoginRequest() { diff --git a/apps/api/src/instrument-repos/instrument-repos.service.ts b/apps/api/src/instrument-repos/instrument-repos.service.ts index b356e22afe..4618a2d040 100644 --- a/apps/api/src/instrument-repos/instrument-repos.service.ts +++ b/apps/api/src/instrument-repos/instrument-repos.service.ts @@ -590,7 +590,8 @@ export class InstrumentReposService implements OnModuleInit { private recordSync( entry: { action: InstrumentRepoSyncAction; repoId: null | string; repoName: string } & ( - { error: unknown } | { result: RepoImportResult } + | { error: unknown } + | { result: RepoImportResult } ) ) { const { action, repoId, repoName } = entry; diff --git a/apps/api/src/mail/__tests__/mail.service.test.ts b/apps/api/src/mail/__tests__/mail.service.test.ts index b2f754e65f..3d99789ca9 100644 --- a/apps/api/src/mail/__tests__/mail.service.test.ts +++ b/apps/api/src/mail/__tests__/mail.service.test.ts @@ -54,10 +54,8 @@ describe('MailService', () => { /** The password as it would come back out of the database. */ const persistedPassword = () => { - return decryptSecret( - (setupStateModel.update.mock.lastCall?.[0] as PersistedUpdate).data.mailConfig.set.password, - SECRET_KEY - ); + const [update] = setupStateModel.update.mock.lastCall ?? []; + return decryptSecret((update as PersistedUpdate).data.mailConfig.set.password, SECRET_KEY); }; beforeEach(async () => { @@ -160,7 +158,8 @@ describe('MailService', () => { it('encrypts the password before it reaches the database', async () => { setupStateModel.findFirst.mockResolvedValue({ id: '1', isSetup: true, mailConfig: stored(validConfig) }); await mailService.updateSettings({ config: { ...validConfig, password: 'new-secret' } }); - const written = (setupStateModel.update.mock.lastCall?.[0] as PersistedUpdate).data.mailConfig.set.password; + const [update] = setupStateModel.update.mock.lastCall ?? []; + const written = (update as PersistedUpdate).data.mailConfig.set.password; expect(written).not.toBe('new-secret'); expect(written).not.toContain('new-secret'); expect(decryptSecret(written, SECRET_KEY)).toBe('new-secret'); diff --git a/apps/gateway/AGENTS.md b/apps/gateway/AGENTS.md index f68a157a03..14a99da26e 100644 --- a/apps/gateway/AGENTS.md +++ b/apps/gateway/AGENTS.md @@ -109,7 +109,7 @@ hydrated tree can disagree with the SSR'd HTML until you do. - `@/` aliases `src/`, declared in both `vite.config.ts` and `tsconfig.json`. - Ambient declarations live in `src/typings/` and `src/vite-env.d.ts`: `res.locals.loadRoot`, `window.__ROOT_PROPS__`, the `cap-widget` JSX element, `__RELEASE__`. -- The eslint blocks for `apps/web` and `packages/react-core` (no default exports, no bare `clsx`, +- The oxlint blocks for `apps/web` and `packages/react-core` (no default exports, no bare `clsx`, `jsx-no-literals`) **do not cover this app**, and default exports are in use. Translation is still required, and there are no translation resource files — `src/services/i18n.ts` initializes with `{}`, so every string is inline `t({ en, es, fr })`. Every interface language needs an entry; diff --git a/apps/gateway/package.json b/apps/gateway/package.json index e640d51f0e..e76af064e0 100644 --- a/apps/gateway/package.json +++ b/apps/gateway/package.json @@ -1,9 +1,9 @@ { "name": "@opendatacapture/gateway", - "type": "module", "version": "0.0.0", "private": true, "license": "Apache-2.0", + "type": "module", "scripts": { "build": "rm -rf dist && pnpm build:client && pnpm build:server && NODE_ENV=production tsx scripts/build.ts", "build:client": "vite build --ssrManifest --outDir dist/client", @@ -12,8 +12,8 @@ "db:push": "env-cmd --silent -f ../../.env prisma db push --skip-generate", "dev": "NODE_ENV=development env-cmd -f ../../.env tsx scripts/dev.ts && env-cmd -f ../../.env node dist/main.js", "dev:test": "NODE_ENV=test env-cmd -f ../../.env tsx scripts/dev.ts && env-cmd -f ../../.env node dist/main.js", - "format": "prettier --write src", - "lint": "tsc && eslint --fix src", + "format": "oxfmt src", + "lint": "tsc && oxlint --fix src", "test": "env-cmd -f ../../.env vitest", "start": "NODE_ENV=production env-cmd -f ../../.env node dist/main.js" }, diff --git a/apps/outreach/AGENTS.md b/apps/outreach/AGENTS.md index c937f1a4bd..a32ceb12b0 100644 --- a/apps/outreach/AGENTS.md +++ b/apps/outreach/AGENTS.md @@ -101,7 +101,7 @@ Tailwind v4 via `@tailwindcss/vite`. Two dark-mode attributes coexist: marketing syncs them. Style against `data-mode` outside of Starlight. `cn` comes from the local `src/utils.ts`, which wraps clsx and tailwind-merge directly. That is -deliberate; the eslint ban on importing those two applies only to `apps/web` and +deliberate; the oxlint ban on importing those two applies only to `apps/web` and `packages/react-core`. ## No React, no tests @@ -110,5 +110,8 @@ Every component is `.astro`; there are no React islands and no client framework configured. Do not introduce one without asking. There is **no `vitest.config.ts` and no test suite in this package** — `pnpm test` does not cover it. -`pnpm --filter @opendatacapture/outreach lint` runs `astro check && eslint --fix src`, and `astro check` +`pnpm --filter @opendatacapture/outreach lint` runs `astro check && oxlint --fix src`, and `astro check` is the only thing type-checking `.astro` files, so run it after any change here. + +`astro check` and typedoc run on this package's own `typescript` 6.0.x devDependency: neither supports +TypeScript 7, which every other workspace uses. diff --git a/apps/outreach/package.json b/apps/outreach/package.json index 67a9564c23..abf2ee452e 100644 --- a/apps/outreach/package.json +++ b/apps/outreach/package.json @@ -1,14 +1,14 @@ { "name": "@opendatacapture/outreach", - "type": "module", "version": "0.0.0", + "type": "module", "scripts": { "astro": "astro", "build": "astro build", "dev": "astro dev", - "format": "prettier --write src", + "format": "oxfmt src", "format:translations": "find src/i18n/translations -name '*.json' -exec pnpm exec sort-json {} \\;", - "lint": "astro check && eslint --fix src" + "lint": "astro check && oxlint --fix src" }, "dependencies": { "@douglasneuroinformatics/libui": "catalog:", @@ -36,6 +36,7 @@ "sharp": "^0.35.5", "tailwindcss": "catalog:", "typedoc": "^0.28.20", - "typedoc-plugin-markdown": "^4.13.1" + "typedoc-plugin-markdown": "^4.13.1", + "typescript": "6.0.x" } } diff --git a/apps/outreach/src/components/blog/PostInfoCard.astro b/apps/outreach/src/components/blog/PostInfoCard.astro index 373fea7711..363949cc88 100644 --- a/apps/outreach/src/components/blog/PostInfoCard.astro +++ b/apps/outreach/src/components/blog/PostInfoCard.astro @@ -7,12 +7,12 @@ import Headshot from '../common/Headshot.astro'; type Props = { author: CollectionEntry<'team'>; + className?: string; datePublished: Date; readingTime: number; - className?: string; }; -const { author, datePublished, readingTime, className } = Astro.props; +const { author, className, datePublished, readingTime } = Astro.props; const { resolvedLanguage, t } = useTranslations(Astro.url); --- @@ -26,11 +26,9 @@ const { resolvedLanguage, t } = useTranslations(Astro.url);

{`${Math.round(readingTime)} ${t('blog.minRead')}`} diff --git a/apps/outreach/src/components/common/Headshot.astro b/apps/outreach/src/components/common/Headshot.astro index f1ea906879..fe3cd4df85 100644 --- a/apps/outreach/src/components/common/Headshot.astro +++ b/apps/outreach/src/components/common/Headshot.astro @@ -14,7 +14,7 @@ const { className, ...props } = Astro.props; - - - - + + - - + diff --git a/apps/outreach/src/components/common/PageHeading.astro b/apps/outreach/src/components/common/PageHeading.astro index 16ba2b269b..ac1083e3b3 100644 --- a/apps/outreach/src/components/common/PageHeading.astro +++ b/apps/outreach/src/components/common/PageHeading.astro @@ -9,6 +9,4 @@ type Props = { const { className, title } = Astro.props; --- -

- {title} -

+

{title}

diff --git a/apps/outreach/src/components/common/Screenshot.astro b/apps/outreach/src/components/common/Screenshot.astro index 195ed2aa5d..0ddc8e94b4 100644 --- a/apps/outreach/src/components/common/Screenshot.astro +++ b/apps/outreach/src/components/common/Screenshot.astro @@ -1,7 +1,9 @@ --- import type { ImageMetadata } from 'astro'; import { Image } from 'astro:assets'; -import { useTranslations, type Language } from '@/i18n'; + +import { useTranslations } from '@/i18n'; +import type { Language } from '@/i18n'; type Props = { alt: string; @@ -10,8 +12,8 @@ type Props = { type Screenshots = { [L in Language]: { - light?: () => Promise; dark?: () => Promise; + light?: () => Promise; }; }; @@ -24,7 +26,7 @@ const images = import.meta.glob(`@/assets/screenshots/*.{jpeg,jpg const screenshots: Screenshots = { en: {}, fr: {} }; for (const path in images) { - const [basename, language, theme] = path.split('/screenshots/').at(-1)?.split('.')!; + const [basename, language, theme] = path.split('/screenshots/').at(-1)?.split('.') ?? []; if (!(basename && (language === 'en' || language === 'fr') && (theme === 'dark' || theme === 'light'))) { throw new Error( `Invalid screenshot path '${path}', expected filename format '*.(dark|light).(en|fr).(jpeg|jpg|png,gif)'` @@ -35,8 +37,8 @@ for (const path in images) { } const sources = { - light: await (screenshots[resolvedLanguage]?.light?.() ?? screenshots[altLanguage]?.light?.()), - dark: await (screenshots[resolvedLanguage]?.dark?.() ?? screenshots[altLanguage]?.dark?.()) + dark: await (screenshots[resolvedLanguage]?.dark?.() ?? screenshots[altLanguage]?.dark?.()), + light: await (screenshots[resolvedLanguage]?.light?.() ?? screenshots[altLanguage]?.light?.()) }; if (!(sources.light && sources.dark)) { diff --git a/apps/outreach/src/components/common/SiteTitle.astro b/apps/outreach/src/components/common/SiteTitle.astro index 5b149cff3a..2f3126887e 100644 --- a/apps/outreach/src/components/common/SiteTitle.astro +++ b/apps/outreach/src/components/common/SiteTitle.astro @@ -1,9 +1,9 @@ --- -import Logo from './Logo.astro'; - import { useTranslations } from '@/i18n'; import { cn } from '@/utils'; +import Logo from './Logo.astro'; + type Props = { className?: string }; const { t, translatePath } = useTranslations(Astro.url); diff --git a/apps/outreach/src/components/docs/InstrumentSchemas.astro b/apps/outreach/src/components/docs/InstrumentSchemas.astro index c84b1768c4..ce72603f10 100644 --- a/apps/outreach/src/components/docs/InstrumentSchemas.astro +++ b/apps/outreach/src/components/docs/InstrumentSchemas.astro @@ -5,13 +5,11 @@ const schemaProps = getSchemaProps(); --- diff --git a/apps/outreach/src/components/docs/Licenses.astro b/apps/outreach/src/components/docs/Licenses.astro index df55510aac..21aea995ac 100644 --- a/apps/outreach/src/components/docs/Licenses.astro +++ b/apps/outreach/src/components/docs/Licenses.astro @@ -5,14 +5,14 @@ import type { ApprovedLicense } from '@opendatacapture/licenses'; // Keyed by the ApprovedLicense union rather than written as an array: adding a license to the union // without listing it here is then a type error, instead of a row that silently goes missing from // this page. That is how CC-BY-4.0, FREE-NOS and PUBLIC-DOMAIN previously fell out of the list. -const approved: Record = { +const approved: { [K in ApprovedLicense]: true } = { '0BSD': true, 'Apache-2.0': true, 'BSD-1-Clause': true, 'BSD-2-Clause': true, 'BSD-3-Clause': true, - 'CC-BY-4.0': true, 'CC0-1.0': true, + 'CC-BY-4.0': true, 'FREE-NOS': true, ISC: true, MIT: true, @@ -53,21 +53,19 @@ const proprietaryLicenses = Array.from(licenses.entries()) distribution:

Please note that instruments in the public domain instruments are also permitted. @@ -80,21 +78,19 @@ const proprietaryLicenses = Array.from(licenses.entries()) included directly in the Open Data Capture repository.

@@ -103,21 +99,19 @@ const proprietaryLicenses = Array.from(licenses.entries()) The following licenses are considered open source, but have not been reviewed by our team.

@@ -127,21 +121,19 @@ const proprietaryLicenses = Array.from(licenses.entries()) licenses with restrictions on commercial use.

diff --git a/apps/outreach/src/components/icons/MoonIcon.astro b/apps/outreach/src/components/icons/MoonIcon.astro index 60f8e5689f..ef5c05461c 100644 --- a/apps/outreach/src/components/icons/MoonIcon.astro +++ b/apps/outreach/src/components/icons/MoonIcon.astro @@ -14,6 +14,5 @@ type Props = Pick; stroke-linecap="round" stroke-linejoin="round" d="M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" - > - + > diff --git a/apps/outreach/src/components/icons/SunIcon.astro b/apps/outreach/src/components/icons/SunIcon.astro index 7d29275f14..3a4ff48eb5 100644 --- a/apps/outreach/src/components/icons/SunIcon.astro +++ b/apps/outreach/src/components/icons/SunIcon.astro @@ -10,6 +10,5 @@ stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" - > - + > diff --git a/apps/outreach/src/components/layout/Head.astro b/apps/outreach/src/components/layout/Head.astro index a69919d6d0..cff775c8d5 100644 --- a/apps/outreach/src/components/layout/Head.astro +++ b/apps/outreach/src/components/layout/Head.astro @@ -1,13 +1,13 @@ --- -import themeInitScript from '@/scripts/theme-init.js?url'; import { useTranslations } from '@/i18n'; +import themeInitScript from '@/scripts/theme-init.js?url'; type Props = { bilingual?: boolean; hasDefaultLocaleRedirect?: boolean; meta?: { - title?: string; description?: string; + title?: string; }; }; @@ -27,17 +27,15 @@ const path = Astro.url.pathname.replace(/^(\/en|\/fr)/, ''); - { - bilingual && ( - <> - - - {hasDefaultLocaleRedirect && } - - - - ) - } + {bilingual && ( + <> + + + {hasDefaultLocaleRedirect && } + + + + )} diff --git a/apps/outreach/src/components/layout/Header.astro b/apps/outreach/src/components/layout/Header.astro index 1ecb8d54bd..6184dc819f 100644 --- a/apps/outreach/src/components/layout/Header.astro +++ b/apps/outreach/src/components/layout/Header.astro @@ -1,13 +1,12 @@ --- import { useTranslations } from '@/i18n'; -import LanguageToggle from './LanguageToggle.astro'; -import NavLink from './NavLink.astro'; -import ThemeToggle from './ThemeToggle.astro'; - import SiteTitle from '../common/SiteTitle.astro'; import MenuIcon from '../icons/MenuIcon.astro'; import XMarkIcon from '../icons/XMarkIcon.astro'; +import LanguageToggle from './LanguageToggle.astro'; +import NavLink from './NavLink.astro'; +import ThemeToggle from './ThemeToggle.astro'; type Props = { altURL?: URL; @@ -40,14 +39,14 @@ const navLinks = [ ]; --- -
+