# Turn On oxlint's Type-Aware Rules and Fix What They Flag

Yes. An agent enables the commented-out type-aware rules in .oxlintrc.json one at a time, fixes each finding, keeps typecheck and tests green and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/enable-type-aware-lint-rules/oxlint/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the lint setup first. In a Next.js and tRPC app laid out like trpc/examples-next-prisma-starter, `package.json` runs `lint` as `oxlint --type-aware --report-unused-disable-directives-severity=warn src`, with `oxlint` ^1.92.0 and `oxlint-tsgolint` ^7.0.2006 as dev dependencies, the second being what type-aware rules run through. `.oxlintrc.json` enables the `react` and `typescript` plugins, turns the `correctness` category off, and in an override for `**/*.js`, `**/*.ts` and `**/*.tsx` lists fifty-five rules as `error`, among them `typescript/await-thenable`, `typescript/no-unnecessary-type-assertion` and `typescript/unbound-method`. Below them sits a comment, "Consider enabling these for more type safety in your app", followed by twelve rules commented out: `no-explicit-any`, `no-floating-promises`, `no-misused-promises`, the six `no-unsafe-*` rules, `prefer-nullish-coalescing`, `require-await` and `restrict-plus-operands`.

It enables them one at a time rather than all at once, running `pnpm lint` after each so every finding is tied to the rule that produced it. Reading the source says where the first findings will be. `src/server/context.ts` declares `createContextInner` as `async` and awaits nothing, which `require-await` reports; dropping the `async` is not enough on its own, because `createContext` then awaits a plain object and the already-enabled `await-thenable` rule reports that, so both lines change together. In `src/pages/index.tsx`, `onClick={() => postsQuery.refetch()}` and `onClick={() => postsQuery.fetchNextPage()}` hand a promise to a handler typed to return nothing, and the form's `onSubmit` is an `async` arrow, which `no-misused-promises` reports in its default configuration; the agent wraps each in `void` or a non-async handler that calls the async work, so the intent to ignore the promise is written down.

Rules with no findings are simply switched on. Rules whose findings are all in generated or third-party types, which the `no-unsafe-*` family tends to produce around `generated/prisma` and `superjson`, get a decision rather than a blanket fix: the agent either narrows the type at the boundary or leaves that rule commented with a one-line reason in the config, and says which in the pull request. `prefer-nullish-coalescing` is checked against lines like `input.limit ?? 50` in `src/server/routers/post.ts` and `process.env.PORT ?? 3000` in `src/utils/trpc.ts`, which already use `??`.

After each rule the agent runs `pnpm typecheck` and `pnpm test-unit`, and once at the end `pnpm build`, so a fix that satisfies the linter but changes behaviour is caught. In its sandbox it runs `pnpm install`, then the loop, with Postgres installed for the unit test in `src/server/routers/post.test.ts`, which writes to the database. The pull request lists each rule, what it flagged, and how the finding was resolved, quoting the lint output before and after.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Enable the type-aware oxlint rules that .oxlintrc.json leaves commented out. Read .oxlintrc.json, package.json, src/server/context.ts, src/pages/index.tsx, src/utils/trpc.ts and src/server/routers/post.ts first. Uncomment one rule at a time, run pnpm lint, fix every finding in the app's own code without disabling comments, and run pnpm typecheck and pnpm test-unit after each rule. For a rule whose findings are only in generated or library types, leave it commented with a one-line reason and say so. Run pnpm build at the end, quote the lint output before and after, and open a pull request that lists each rule and what it changed.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request that changes `.oxlintrc.json` and the handful of source files the new rules reached, typically `src/server/context.ts`, `src/pages/index.tsx` and `src/utils/trpc.ts`. Each rule is a separate commit, so a reviewer can read `no-floating-promises` on its own and revert one rule without touching the rest.

The description quotes `pnpm lint` with the rules enabled and no findings, the typecheck and unit test results, and the `next build` output. A rule left commented is listed with the reason the agent wrote beside it in the config, which is also what the next person reads when they consider enabling it.

The repository's `Testing` workflow runs its `unit` job, which includes `pnpm tsc`, on the branch, so the check sits beside the agent's run. A reviewer decides whether a `void` in front of a handler is the house style or whether the team prefers a small `useCallback` wrapper, and whether the rules the agent left commented should stay that way.

## Run it on every Monday morning

In the Project that holds the repository, create an automation with a prompt that enables the next commented-out rule only, fixes its findings, runs the checks and opens a pull request, and give it a `schedule` trigger with `cron` set to `0 9 * * 1` and the team's `timezone`. The prompt ends with: if no rule is left commented out, open nothing. One rule a week is a pull request a reviewer reads in minutes, and the config itself records the progress.

Each run opens its own pull request on its own branch; a week whose rule had no findings still ships the one-line config change. When the list is empty the automation becomes a no-op, and the team disables it from the Project.

## Why run it on Rush?

Type-aware linting is a loop of enable, run, read, fix and rerun, with a typecheck and a test run after every step. Each pass takes the lint, the Prisma client and a database, and the loop runs twelve times. A sandbox runs the whole loop from a clean start and keeps every output, so the pull request shows each rule's findings and each fix rather than one squashed diff.

The run's record keeps the lint output for every rule, so a reviewer can see what `no-misused-promises` flagged before deciding whether `void` is the right answer. Across a team's TypeScript repositories the same request runs at once, one sandbox each, with each pull request listing that repository's own rules and findings.

## Frequently asked questions

### Why one rule at a time instead of uncommenting the block?

So each finding is attributed to the rule that produced it and each fix is a commit a reviewer can read or revert alone. Enabling all twelve at once produces one list of findings and one large diff, with no way to tell which rule caused which change.

### Will the agent add oxlint-disable comments?

No. The request says to fix the app's own code. For findings in generated or library types, the agent leaves that rule commented out with a reason, which the pull request names, rather than scattering disables through the source.

### Does this slow down pnpm lint?

Type-aware rules already run: the `lint` script passes `--type-aware`, and `oxlint-tsgolint` is installed. Enabling more rules in the same pass adds checks to a run that is already computing types.

### What about the correctness category that is off?

That is a separate decision, since turning it on changes what every plugin reports. The agent leaves it as it is and mentions it in the description so the team can ask for it as a follow-up.

## More jobs like this: Hand off a long task

- [Make Kubernetes Manifests Pass the Restricted Pod Security Standard](https://getrush.ai/run/enforce-pod-security-restricted/kubernetes/)
- [Find Dead Code in a Flask App](https://getrush.ai/run/find-dead-code/flask/)
- [Find Dead Code in a Go Project](https://getrush.ai/run/find-dead-code/go/)
- [Fix the babel-preset-react-app private-property-in-object Warning](https://getrush.ai/run/fix-babel-preset-react-app-private-property-in-object-warning/create-react-app/)
- [Fix the Celery broker_connection_retry Deprecation Warning](https://getrush.ai/run/fix-broker-connection-retry-deprecation-warning/celery/)
- [Fix Deprecations in an Ember App](https://getrush.ai/run/fix-deprecated-apis/ember/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
