Skip to content

feat(scripts): migrate retext-runner to type-checked TypeScript #3174

Description

Issue Description

Convert the eval text-moderation runner scripts/evals/Modules/retext-runner.mjs to strictly typed TypeScript as retext-runner.mts, and enforce the types in local validation and PR CI.

Node 24, the version pinned in CI, the devcontainer, and Copilot setup, runs .mts files directly through built-in type stripping, so no build step or generated output is needed. .mts is used instead of .ts because the root package.json has no "type": "module". A .ts file would print a MODULE_TYPELESS_PACKAGE_JSON warning to stderr on every run.

Scope:

  • Rename the runner to .mts with strict, erasable-only types. Its stdin/stdout/exit-code contract and output must stay byte-identical.
  • Add exact-pinned typescript and @types/node dev dependencies, a root tsconfig.json, and an npm run lint:ts (tsc --noEmit) check, and add lint:ts to validate:local.
  • Run lint:ts on every PR through a new reusable typescript-check.yml workflow that is part of the PR validation gate.
  • Point Test-EvalSpecText.ps1 at the new file.
  • Teach Test-CopyrightHeaders.ps1 to scan .mts with // comments. Today .mts is skipped.
  • Update the contributor docs that name the runner path or list validation commands.

Additional Context

  • While prototyping, the type check found a dead fallback in the current runner: message.position does not exist on vfile-message v4 messages. The conversion removes it without changing behavior.
  • Other .mjs files, a root "type": "module", and .cts support are out of scope.
  • Known follow-up, not part of this issue: the root spell-check glob does not scan .mjs, .mts, or .cjs sources.

Activity

  1. added
    lintingLinting rules and validation
    priority-3Medium priority, standard queue
    workflowsGitHub Actions workflows
    and removed
    needs-triageRequires triage and prioritization
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

evalsfeatureNew feature triggering minor version bumplintingLinting rules and validationpriority-3Medium priority, standard queuescriptsPowerShell, Bash, or Python scriptsworkflowsGitHub Actions workflows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions