# Add ESLint to a SolidJS App

Yes. An agent adds ESLint with the Solid plugin to your SolidJS app, lints JSX in .js files, fixes what it finds, adds a lint script and CI step, and opens a PR.

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

## What the agent does

The agent reads the project before choosing a config. In an app like solidjs/solid-realworld there are 26 source files, about 1,300 lines, all `.js` with JSX inside: `rollup.config.js` compiles them with `@rollup/plugin-babel` and `babel-preset-solid`, resolving `.js` and `.jsx`, and terser minifies when `production` is set. `package.json` has `start`, `build` and a placeholder `test` script that only runs `test`; there is no lint script and no ESLint dependency, but a `.prettierrc` exists with `printWidth: 100`, double quotes and `trailingComma: "none"`. `src/index.js` renders `<Provider><App /></Provider>` into `document.body`; `src/store/index.js` builds a store with `createStore` and getters backed by resources; `src/App.js` routes with `<Switch>` and `<Match>` behind `<Show>` and `<Suspense>`.

Those last four are the first thing a linter trips on: `App.js` imports only `lazy`, `createSignal` and `createComputed` from `solid-js`, and `ListErrors.js`, `ArticleList.js` and `Editor.js` use `<Show>` or `<For>` the same way, with no import. The Babel preset adds those imports at compile time, so the app runs, but a plain `no-undef` rule reports them. `eslint-plugin-solid` knows this: its `solid/jsx-no-undef` rule, with `autoImport` on by default, adds `import { Show, Switch, Match, Suspense } from "solid-js"` as a fix. The agent uses the plugin's flat recommended config in `eslint.config.mjs`, since `package.json` is not an ES module, with `@eslint/js` recommended, browser globals for `fetch`, `localStorage` and `document`, `ecmaFeatures.jsx` on for `.js` files, and `eslint-config-prettier` last so formatting stays with Prettier.

Then it runs `npx eslint src` and reads every finding in context. Solid-specific ones are the useful part: `src/components/ArticlePreview.js` destructures `{ article, token, onClickFavorite }` from props in the component signature, which `solid/reactivity` flags because a destructured prop stops tracking; `onClick={[onClickFavorite, article]}` is Solid's tuple handler form and is allowed; `createComputed(() => store.currentUser && setAppLoaded(true))` in `App.js` is fine. The agent applies the automatic fixes, rewrites trivial destructuring to `props.article` style where the component is small, and leaves `solid/reactivity` at `warn` for the rest, each remaining warning listed in the pull request with the file and line rather than silenced.

The remaining pieces are `lint` and `lint:fix` scripts, the new dev dependencies in `package.json` and `package-lock.json`, and one step in the existing `.github/workflows/gh-pages.yml`, which already runs on pull requests with `npm install` and `npm run build` on Node 14 before deploying from `main`: `npm run lint` goes between install and build. The agent runs `npm run build` after the fixes to show the Rollup bundle still builds, since adding imports to files the preset used to patch must not change the output.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add ESLint to this SolidJS project. Read package.json, rollup.config.js, .prettierrc, the workflow under .github/workflows and every file under src first. Install eslint, @eslint/js, eslint-plugin-solid, eslint-config-prettier and globals as dev dependencies and write a flat config that lints .js files containing JSX with the Solid plugin's recommended rules, browser globals and Prettier compatibility. Run eslint over src, apply the safe automatic fixes including explicit imports for Solid's built-in components, fix small reactivity findings by reading props through the props object, and keep the rest as warnings listed in the pull request with file and line. Add lint and lint:fix scripts, add a lint step to the existing workflow before the build step, run the build to confirm the bundle still compiles, and open a pull request.",
  "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 with `eslint.config.mjs`, the dev dependencies and scripts in `package.json` and the matching `package-lock.json` entries, one added step in `.github/workflows/gh-pages.yml`, and source edits of two kinds: explicit `solid-js` imports where components were used without them, and props accessed through `props` where a destructured prop was flagged. Nothing in `rollup.config.js` or `public/index.html` changes.

The description has three lists: the rules in the config and why each is there, the findings fixed automatically with their rule names, and the warnings left in place with file, line and the reason they need a human. The lint output before and after and the Rollup build output are in the transcript at `GET /o/{org}/sessions/{id}/messages`.

A reviewer checks that the new workflow step ran on the pull request, reads the reactivity edits since those touch behaviour, and decides whether `solid/reactivity` should become an error now or after the listed warnings are cleared. A follow-up on the same session can clear them file by file.

## Run it on every repository without a linter

A team that built several small Solid front ends from the same example runs this once per repository: the body above to `POST /o/{org}/sessions` with each repository in `resources`, one run each, and a `request_id` that is a UUID v5 of the repository name so a retry is safe. Give the key a `webhook_url` and each run posts `run.completed` with `data.session_url` when its turn ends; a handler reads the pull request link from the session.

Once it lands, an automation in the Project with a `github` trigger on `pull_request.opened` and `pull_request.synchronize` can run `npm run lint` on each pull request's branch and comment on new findings. The trigger clones that branch and appends the event after the prompt, and the automation starts no more than its `max_runs_per_hour` runs in an hour.

## Why run it on Rush?

Adding a linter to a Solid codebase is mostly judgement about reactivity, and that judgement needs the whole repository and the build in front of it: which components the Babel preset was quietly importing for the source, which destructured props are harmless, whether the fixed files still bundle. The agent does that in a sandbox with the real source, runs the linter and the build, and reports both.

The run keeps every command and its output, so the pull request's list of fixed and remaining findings can be checked against the actual ESLint output rather than taken on faith. A team with several Solid apps can lint them all at once, each in its own sandbox, each with its own pull request.

## Frequently asked questions

### Why does the linter say Show and Switch are not defined when the app works?

`babel-preset-solid` imports Solid's built-in components for you at compile time, so the app runs. ESLint reads the source, not the compiled output. `solid/jsx-no-undef` adds the explicit imports, which also makes the files honest about what they use.

### Will the reactivity fixes change behaviour?

Slightly, and for the better. A component that destructures `{ article }` from props reads it once; reading `props.article` inside JSX keeps it reactive if the parent ever changes it. The agent only rewrites small components this way and lists every such edit for review; anything larger stays a warning.

### Does ESLint conflict with the existing Prettier config?

No. `eslint-config-prettier` is last in the config and turns off every formatting rule, so `.prettierrc` keeps its `printWidth: 100` and double quotes, and ESLint reports only code problems.

### The files are .js, not .jsx. Does that matter?

The config sets `ecmaFeatures: { jsx: true }` for `**/*.js`, matching how `rollup.config.js` resolves both extensions, so JSX in `.js` parses. If you later rename files to `.jsx`, the same block covers them.

## More SolidJS jobs

- [Add Form Validation to a SolidJS App](https://getrush.ai/run/add-form-validation/solidjs/)
- [Set Up GitHub Actions CI for a SolidJS App](https://getrush.ai/run/add-github-actions-ci/solidjs/)
- [Add Translations to a SolidJS App With @solid-primitives/i18n](https://getrush.ai/run/add-i18n/solidjs/)

## The same job on other stacks

- [Add ESLint to a Chrome Extension](https://getrush.ai/run/add-eslint/chrome-extension/)
- [Add ESLint to a Node.js App](https://getrush.ai/run/add-eslint/nodejs/)

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

- [Add Fastlane to a Flutter App](https://getrush.ai/run/add-fastlane/flutter/)

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