# Migrate a VS Code Extension to ESLint Flat Config

Yes. An agent moves a VS Code extension from .eslintrc.json on ESLint 8 to eslint.config.js on ESLint 9 and typescript-eslint 8, runs the lint and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/migrate-eslint-flat-config/vscode-extension/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent clones the repository into its own cloud sandbox and reads the lint setup as it stands. In an extension like usernamehw/vscode-error-lens, `package.json` pins `eslint` `^8.57.1` with `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin` at `^5.62.0`, beside `typescript` `^6.0.3`, `webpack` 5 and `ts-loader`; there is no `lint` script, so linting happens only through the editor, and `.vscode/extensions.json` recommends `dbaeumer.vscode-eslint` for that. The `.eslintrc.json` is the real work: `root: true`, an `env` of `node` and `es2020`, `parserOptions.project` pointing at `tsconfig.json` for type-aware rules, four `extends` entries including `recommended-requiring-type-checking` and `strict`, and about 450 rule lines, 132 of them `@typescript-eslint/` rules, many with option objects, such as `naming-convention` with a `strictCamelCase` format and a filter for underscores, `explicit-member-accessibility` with per-member overrides and `no-floating-promises` with `ignoreVoid`. The agent also reads `tsconfig.json`, which includes only `src/**/*.ts`, 32 files, and `webpack.config.js`, so the config files themselves are not linted as source.

It writes `eslint.config.js` in the flat format and deletes `.eslintrc.json`. The `extends` chain becomes an array: `@eslint/js` recommended, then `tseslint.configs.strictTypeChecked` from `typescript-eslint` 8, which folds `recommended`, `recommended-requiring-type-checking` and `strict` into one set under their current names; `parserOptions.project` becomes `languageOptions.parserOptions.projectService` with `tsconfigRootDir`, and the `env` block becomes `languageOptions.globals` from the `globals` package for Node and ES2020. The rules object is carried over line by line with its option objects intact. Rules that typescript-eslint renamed or removed between major 5 and major 8 are the delicate part: `ban-types` is split into `no-restricted-types`, `no-unsafe-function-type` and `no-wrapper-object-types`, so the existing ban on `null` with its message moves into `no-restricted-types`; `no-type-alias` and `no-empty-interface` are gone, and deprecated rules the config turned off anyway are dropped rather than carried as dead lines. Each such change is listed in the pull request so the author can see that no rule silently vanished.

Because `typescript-eslint` 8 drops support for ESLint 8, `package.json` moves to `eslint` 9, replaces the two `@typescript-eslint/*` packages with `typescript-eslint`, adds `@eslint/js` and `globals`, and gains a `lint` script, `eslint src`, so the check can run in a terminal and later in CI. The `.vscodeignore` already excludes `tsconfig.json` and `.editorconfig` from the packaged extension, and the agent adds the new config file there too so it never ships inside the `.vsix`. `.vscode/settings.json` keeps `eslint.validate` on `typescript`; the ESLint extension reads flat config on its own, so nothing else in the editor settings changes.

Then it runs the lint. `npm install` with the new versions, `npx eslint src` for the whole tree, and `npx eslint --print-config src/extension.ts` before and after the change to diff the effective rule set for one file, which is the honest way to show the migration preserved intent. Type-aware rules make the first run slow, so the agent also times it and notes whether `projectService` or an explicit `project` is faster for this tree. Rules that now fire where they did not before, because `strictTypeChecked` is stricter than the old `strict` preset, are left as reported findings in the description rather than fixed in source, so the pull request stays a configuration change and the author decides which new findings to accept.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Migrate this VS Code extension from its .eslintrc configuration to ESLint flat config. Read package.json, .eslintrc.json, tsconfig.json, webpack.config.js, .vscodeignore and the .vscode directory first. Write eslint.config.js that preserves every rule and option from the old file using typescript-eslint's current preset names, languageOptions with the globals package and the TypeScript project service, and delete the old file. Upgrade eslint to version 9 and replace the two @typescript-eslint packages with typescript-eslint, adding @eslint/js and globals. For every rule that was renamed, split or removed between the old and new major versions, carry its intent into the current rule and list the change. Add a lint script and keep the config file out of the packaged extension. Run npm install and the lint over the source tree, diff eslint --print-config for one source file before and after, and report new findings without changing source files. Open a pull request with the diff of effective rules and the lint output.",
  "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 deletes `.eslintrc.json`, adds `eslint.config.js`, changes the lint-related lines of `package.json` and `package-lock.json`, adds one line to `.vscodeignore` and touches nothing under `src/`. The description has a table of every rule that did not map one to one: the old name, the rule or rules it became, and how its options were carried, so the 132 TypeScript rules can be audited without reading the whole file.

The run's record holds `npm install`, the `eslint --print-config` output for one source file on both configs with the diff between them, and the full lint run on `src/`. New findings from the stricter preset are listed by rule and count in the description, each with a one-line note on whether the agent would accept the finding or turn the rule down, so the author can decide in review.

Before merging, a reviewer runs the editor against the branch to confirm the ESLint extension picks up the flat config, decides which of the new findings to keep as errors and which to set to warnings, and whether the new `lint` script should also run in CI, which is a one-step addition to a workflow once the script exists.

## Run it on every extension repository still on .eslintrc

In the console, an automation in the Project that has the repository, with a `schedule` trigger set to `cron` for one early morning a week, starts a run with this prompt. The prompt asks the run to finish at once if `eslint.config.js` already exists and otherwise to perform the migration, so each extension repository is migrated once and later fires cost one file check. When an organisation has many extensions, one automation per Project covers each.

From your own server, send this body as `POST /o/{org}/sessions` with each extension repository in `resources`, with a `request_id` that is a UUID v5 of the repository name so a retried call returns the run it already started. Set a `webhook_url` on the key to receive `run.completed` with `data.session_url` when each pull request is open.

## Why run it on Rush?

A flat config migration for a 450-line rule file is mostly bookkeeping with a few traps, the renamed and split rules, and the only way to be sure nothing was lost is to compare the effective configuration ESLint computes before and after, on the real dependency versions. The agent's sandbox is a clean machine where it installs both sets of packages, prints both configs, diffs them and runs the lint, and every one of those commands and its output is in the run's record beside the pull request.

The same request runs across every extension an organisation maintains, each in its own sandbox with its own rule file and its own list of renamed rules, which is how a team gets off ESLint 8 across all of them in one review cycle instead of one afternoon per repository.

## Frequently asked questions

### Will the agent fix the new lint findings too?

No. The stricter `strictTypeChecked` preset fires on code the old config accepted, and deciding whether each finding is a real problem or a rule to turn down is the author's call. The pull request lists them by rule with a suggestion for each, and a follow-up run can fix the ones you accept.

### What happens to rules that no longer exist?

Each is mapped to its replacement where one exists, such as `ban-types` into `no-restricted-types` and its siblings, with the options carried over. Rules that were removed outright and were already turned off are dropped, and both cases are listed in the pull request so nothing disappears unannounced.

### Does the VS Code ESLint extension need any setting for flat config?

Current versions of `dbaeumer.vscode-eslint` detect `eslint.config.js` on their own. The existing `eslint.validate` setting for TypeScript stays. If the team is pinned to an old extension version, the pull request notes the setting that forces flat config on.

### Why switch from parserOptions.project to projectService?

It is the current typescript-eslint way to enable type-aware rules and finds the right `tsconfig.json` per file without a hard-coded path. The agent times the lint both ways on this tree and keeps the faster one, saying which in the description.

### Will this change what gets packaged into the .vsix?

No. The config file is added to `.vscodeignore` beside the other development files already listed there, and the webpack build that produces `dist/extension.js` does not read it.

## More VS Code extension jobs

- [Migrate a VS Code Extension from TSLint to ESLint](https://getrush.ai/run/migrate-tslint-to-eslint/vscode-extension/)
- [Migrate a VS Code Extension from Webpack to esbuild](https://getrush.ai/run/migrate-webpack-to-esbuild/vscode-extension/)
- [Review Every Pull Request on a VS Code Extension Repository](https://getrush.ai/run/review-pull-requests/vscode-extension/)

## The same job on other stacks

- [Migrate an ESLint 8 Project from .eslintrc to Flat Config](https://getrush.ai/run/migrate-eslint-flat-config/eslint/)
- [Migrate an Express Project to ESLint Flat Config](https://getrush.ai/run/migrate-eslint-flat-config/express/)
- [Migrate a Lit Component Library to ESLint Flat Config](https://getrush.ai/run/migrate-eslint-flat-config/lit/)

## 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/)
