# Migrate a VS Code Extension from TSLint to ESLint

Yes. An agent replaces TSLint with ESLint and typescript-eslint in your VS Code extension, maps every rule, keeps the warning count the same, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/migrate-tslint-to-eslint/vscode-extension/). 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 and everything that depends on it. In an extension like aaron-bond/better-comments, `package.json` has `tslint ^6.1.3` and `typescript ^4.6.3` as devDependencies, a `lint` script of `tslint -c tslint.json 'src/**/*.ts'`, `engines.vscode ^1.65.0` with `@types/vscode ^1.65.0`, a `main` of `./out/extension` built by `tsc -p ./` and a `browser` entry at `./out/web/extension.js` built by webpack 5 from `build/web-extension.webpack.config.js` with `ts-loader`; `vscode:prepublish` runs `compile` and `package-web`, and lint is not part of it. `tslint.json` enables seven rules: `no-string-throw`, `no-unused-expression`, `no-duplicate-variable`, `curly` with `ignore-same-line`, `class-name`, `semicolon` set to `always` and `triple-equals`, with `defaultSeverity` at `warning`. `tsconfig.json` is `strict`, targets `es6` with `commonjs` modules and excludes `src/test*`, while the TSLint glob includes the test directory. There is no `test` script, `src/test/index.ts` still requires `vscode/lib/testrunner` from a package no longer installed, there are no GitHub workflows, and `.travis.yml` pins Node 8.9.2.

It then maps each rule to its ESLint equivalent at the same severity, so the migration changes the tool and not the standard: `no-string-throw` becomes `no-throw-literal`, `no-unused-expression` becomes `@typescript-eslint/no-unused-expressions`, `no-duplicate-variable` becomes `@typescript-eslint/no-redeclare`, `curly` with `ignore-same-line` becomes `curly` with `multi-line`, `class-name` becomes `@typescript-eslint/naming-convention` for the `class` selector in PascalCase, `semicolon` becomes the `semi` rule from `@stylistic/eslint-plugin` set to `always`, since the core rule is deprecated, and `triple-equals` becomes `eqeqeq`. Every rule is set to `warn`. It does not enable the recommended rule sets in the same change, because `src/parser.ts` and `src/configuration.ts` use `let` and `any` casts throughout and the recommended set would add hundreds of findings; it offers that as a follow-up in the pull request.

It writes `eslint.config.mjs` as a flat config using `typescript-eslint` with `files` matching the old glob, `src/**/*.ts`, and `ignores` for `out/` and `node_modules/`, replaces the `lint` script with `eslint src`, removes `tslint` and `tslint.json`, and adds `eslint`, `typescript-eslint` and `@stylistic/eslint-plugin` as devDependencies. If `.vscode/settings.json` or `.vscode/extensions.json` mention TSLint, it switches them to the ESLint extension. It checks that `typescript-eslint` accepts the project's TypeScript 4.6 or says which TypeScript bump is needed and keeps it minimal.

In its sandbox it runs `npm ci`, runs the old `tslint` command and counts its warnings per rule, then runs the new `eslint src` and compares: the same files, the same lines, the same count, including the missing semicolon after the `json5` import in `src/configuration.ts`, which both tools flag at warning level. It then runs `npm run compile` and `npm run package-web` to show the desktop and web builds are untouched, and `npx vsce package` to show the extension still packs, and opens the pull request with the before-and-after counts.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Migrate this VS Code extension from TSLint to ESLint and open a pull request. Read package.json, package-lock.json, tslint.json, tsconfig.json, build/web-extension.webpack.config.js, .vscodeignore, the files under .vscode and every file under src first. Write eslint.config.mjs as a flat config with typescript-eslint, covering the same src/**/*.ts glob the TSLint script used, and map each tslint.json rule to its ESLint equivalent at warning severity: no-throw-literal, no-unused-expressions, no-redeclare, curly multi-line, naming-convention for classes, semi always from the stylistic plugin, and eqeqeq. Do not enable recommended rule sets. Replace the lint script, remove tslint and tslint.json, and update any editor settings that reference TSLint. Run the old lint and the new lint and compare the warnings per rule and per file, then run npm run compile, npm run package-web and npx vsce package. Open a pull request with the rule mapping table and the before-and-after warning counts.",
  "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 on its own branch that adds `eslint.config.mjs`, deletes `tslint.json`, and changes `package.json` and `package-lock.json` to swap the devDependencies and the `lint` script. The description has a table of the seven TSLint rules with the ESLint rule each became and its severity, the warning count per rule before and after with any difference explained, and the output of `npm run compile`, `npm run package-web` and `vsce package` showing the builds still succeed.

Before merging, a reviewer checks the rule mapping against their intent, in particular whether `curly` with `multi-line` is the behaviour they want in place of `ignore-same-line`, and whether to accept the follow-up offer to turn on the recommended sets and fix what they find. They also decide whether to add a lint step to `vscode:prepublish` now that the tool is current.

## Run it on every extension repository still on TSLint

A publisher with several extensions sends one `POST /o/{org}/sessions` per repository, this prompt and the repository in `resources`. `GET /o/{org}/github` lists every repository the Rush GitHub App installation can reach, so a script can start a run for each one whose `package.json` has `engines.vscode` and a `tslint` devDependency. Each run reads that extension's own `tslint.json`, so one with twenty rules or with `defaultSeverity` at `error` gets its own mapping and its own pull request.

Set a webhook URL on the API key and Rush posts `run.completed` or `run.failed` when a run's turn finishes, with `session_url` so your server can read the pull request link. Send a fresh UUID as `request_id` with each request so a retry returns the run already started.

## Why run it on Rush?

The hard part of a lint migration is not writing the config but proving it enforces the same thing: the same files in scope, the same rules at the same severity, the same warnings on the same lines. On Rush the agent runs both tools over the same tree in its own sandbox and compares their output rule by rule, then runs the desktop and web builds and packs the extension, so the pull request carries evidence that nothing changed except the tool.

Every command and its output stay in the run's record, and the pull request is a readable config file and a dependency swap. The same request migrates every extension a publisher maintains, one sandbox and one pull request each, with no TSLint left on anyone's machine.

## Frequently asked questions

### Will the migration add new lint errors?

No. Every mapped rule is set to `warn`, matching `defaultSeverity` in `tslint.json`, and the recommended rule sets stay off, so the new lint reports the same findings as the old one. Turning on the recommended sets is offered as a follow-up with its own count.

### Does it touch the webpack web build or the tsc build?

No. `build/web-extension.webpack.config.js` uses `ts-loader` and `tsc -p ./` reads `tsconfig.json`; neither reads the lint config. The agent runs `npm run compile` and `npm run package-web` after the change to show both still succeed.

### What happens to the old test runner file?

`src/test/index.ts` requires `vscode/lib/testrunner` from a package that is no longer a devDependency, so it does not run today. The agent lints it like the TSLint glob did and names it in the pull request, but replacing the test runner is a separate job.

### Which TypeScript version does typescript-eslint need?

The agent checks the installed `typescript-eslint` against the project's TypeScript 4.6 in the sandbox. If the current plugin refuses that TypeScript, the pull request bumps TypeScript by the smallest amount that works and shows `npm run compile` passing on it.

## More VS Code extension jobs

- [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/)
- [Upgrade a VS Code Extension to the Latest API](https://getrush.ai/run/upgrade-vscode-engine/vscode-extension/)

## The same job on other stacks

- [Migrate a TypeScript Monorepo from TSLint to ESLint Flat Config](https://getrush.ai/run/migrate-tslint-to-eslint/tslint/)

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

- [Migrate a Python Test Suite From unittest to pytest](https://getrush.ai/run/migrate-unittest-to-pytest/unittest/)
- [Migrate a Laravel Front End from Vue 2 to Vue 3](https://getrush.ai/run/migrate-vue-2-to-vue-3/laravel/)

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