# Fix "TypeError: prettier.resolveConfig.sync is not a function" when ESLint runs

Yes. An agent moves eslint-plugin-prettier to the major that works with Prettier 3, carries ESLint and its parser with it, and shows lint passing again.

[Run this on Rush](https://cloud.getrush.ai/run/fix-prettier-resolveconfig-sync-is-not-a-function/prettier/). 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 before touching versions. In kimroen/ember-cli-autoprefixer, an Ember addon, `package.json` runs `eslint . --cache` as `lint:js`, and `.eslintrc.js` extends `plugin:prettier/recommended` with `parser: 'babel-eslint'` and `ecmaVersion: 2018`. The devDependencies pin `prettier` at `^2.4.1`, `eslint-plugin-prettier` at `^4.0.0`, `eslint-config-prettier` at `^8.3.0`, `eslint` at `^7.32.0` and `babel-eslint` at `^10.1.0`, and `package-lock.json` holds prettier 2.4.1, eslint 7.32.0, eslint-plugin-prettier 4.0.0 and eslint-config-prettier 8.3.0. `.prettierrc.js` sets `singleQuote: true`, and the CI workflow runs `npm ci`, then `npm run lint`, then `ember test` on Node 12.

With the lock as committed, `npm ci` installs those versions and `eslint .` passes with no output. Bumping Prettier to 3.9.10, the kind of change a dependency bot proposes, is accepted by npm without complaint, because eslint-plugin-prettier 4.0.0 declares a peer range of `prettier >=2.0.0` with no upper bound; 4.2.1 says the same. The break is at runtime: `eslint .` stops on the first file with `TypeError: prettier.resolveConfig.sync is not a function`, raised from `eslint-plugin-prettier.js` line 136 while linting `.eslintrc.js`. The cause is on Prettier's side: 2.8.8 exports `resolveConfig.sync` as a function, 3.0.0, published 2023-07-05, does not, and `resolveConfig` is the only form left.

The plugin that understands Prettier 3 is eslint-plugin-prettier 5, published from 2023-07-11, and its peer range is `eslint >=8.0.0` and `prettier >=3.0.0`, so installing it next to eslint 7 is refused by npm with `ERESOLVE unable to resolve dependency tree`. Moving eslint to 8.57.1 lets the plugin install, and then every file fails to parse with `Class extends value [object Module] is not a constructor or null`, because `babel-eslint` 10 does not work with ESLint 8. Its successor is `@babel/eslint-parser`, and the version to pick is deliberate: 8.0.7 declares a peer of `eslint ^9.0.0 || ^10.0.0`, while 7.29.13 accepts `^7.5.0 || ^8.0.0 || ^9.0.0` with `@babel/core ^7.11.0`. With `@babel/eslint-parser@7`, `@babel/core@7`, `parser: '@babel/eslint-parser'` and `requireConfigFile: false` in `parserOptions`, ESLint parses every file again.

What is left is Prettier 3 itself. Its defaults changed, and the one this repository hits is the trailing comma: `eslint .` now reports one error, in `index.js` at line 42, `Insert ","` after the last argument of a multi-line call. `eslint . --fix` adds the comma and the run ends clean. The agent keeps that one-line change in the pull request as the visible cost of the new default, and notes `.prettierrc.js` as the place to set `trailingComma: 'es5'` if the team prefers the old output.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "After a dependency update, our lint script fails with \"TypeError: prettier.resolveConfig.sync is not a function\". Read package.json, the lock file, the ESLint and Prettier config files and the CI workflow, and say which versions of prettier, eslint, eslint-plugin-prettier, eslint-config-prettier and the ESLint parser are locked and which the update moved. Confirm by installing them which Prettier release dropped resolveConfig.sync and which eslint-plugin-prettier release supports Prettier 3, and quote the peer dependency ranges that decide what can be installed together. Upgrade the plugin, and whatever ESLint and parser versions its peer ranges require, choosing versions whose peer ranges match each other rather than forcing the install. Update the ESLint config for the new parser. Run the lint script, apply any formatting changes Prettier 3's defaults introduce with --fix, and run it again clean. Open a pull request with the version findings, the peer ranges, the lint output at each step and the formatting diff kept separate from the dependency changes.",
  "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

A pull request with three kinds of change, kept apart in the description. The dependency change: `prettier` to 3, `eslint-plugin-prettier` to 5, `eslint` to 8, `babel-eslint` removed and `@babel/eslint-parser` 7 with `@babel/core` 7 added, with the lock refreshed. The config change: `.eslintrc.js` names the new parser and sets `requireConfigFile: false`. And the formatting change: the trailing comma in `index.js` line 42 that Prettier 3's default adds. The description quotes the peer ranges that forced each step, the `ERESOLVE` message that refused the plugin next to eslint 7, and the parser error that followed eslint 8.

The reviewer checks that no install used `--force` or `--legacy-peer-deps`, since the point of the chain is a tree whose peer ranges agree; that `eslint-config-prettier` still satisfies the new plugin's peer range; and that the formatting diff is only what the new defaults produce, nothing hand-edited. The lint output at each step is in the description, so the reviewer sees the one error before `--fix` and the clean run after.

What the run does not do is run the Ember test suite. CI runs `ember test` on Node 12 after lint, and the sandbox runs the lint script only; whether the addon's own tests still pass on the Node version in CI is the reviewer's check, and the pull request says so.

## Run it on every dependency bot pull request that fails lint

This error arrives as a red check on a bot's pull request, where the lint job fails while the install step passed. A step in that workflow that runs only when lint fails can send the job's log tail to a Rush `webhook` trigger's URL, with the trigger's secret in `Authorization: Bearer`; the log text is placed after the saved prompt as the event, so the prompt tells the agent to start from the TypeError in it and to work on the bot's branch. Send an `Idempotency-Key` header to the trigger's URL set to the head commit, so a re-run of the same job starts nothing new.

If the repository has no bot and lint breaks after a hand-made bump, the same trigger serves, called from the failing job. Keep the automation's runs per hour low in either case: one bot can open several pull requests in a morning, and each one that fails lint would start a run.

## Why run it on Rush?

The fix is a chain of four peer ranges, and each link is cheap to check by installing and expensive to guess. A laptop with the old lock shows nothing wrong, and a laptop where someone forced the install shows a tree that works until the next bump. A Rush sandbox starts from the committed lock, reproduces the TypeError, tries each upgrade in order, and keeps every `ERESOLVE` message and every parse error, so the pull request explains why each version was chosen rather than asserting it.

Formatting tools also change their defaults across majors, and the diff that follows is the part a reviewer most wants to see on its own. The run separates the dependency changes from the `--fix` output, so the one-line comma change is visible as what Prettier 3 did and not mixed into the version bump.

## Frequently asked questions

### Which Prettier release removed resolveConfig.sync?

Prettier 3.0.0, published 2023-07-05. Installed side by side, 2.8.8 exports `resolveConfig.sync` as a function and 3.0.0 exports only `resolveConfig`. eslint-plugin-prettier 4 calls the sync form on every file it lints, which is why the error appears the moment ESLint starts.

### Why did npm let Prettier 3 install next to the old plugin?

Because eslint-plugin-prettier 4.0.0 and 4.2.1 both declare a peer range of `prettier >=2.0.0` with no upper bound. npm sees a satisfied range and installs it. The plugin's 5.x line declares `prettier >=3.0.0` and `eslint >=8.0.0`, which is where the real requirement lives.

### Can I upgrade the plugin without upgrading ESLint?

Not with a consistent tree. eslint-plugin-prettier 5 requires `eslint >=8.0.0`, so next to eslint 7 npm answers `ERESOLVE unable to resolve dependency tree`. Forcing it past that leaves a tree the next install may refuse. The alternative is to keep Prettier 2 until ESLint can move.

### Why does ESLint 8 then fail with 'Class extends value [object Module]'?

That is `babel-eslint` 10, which does not work as a parser under ESLint 8. Its successor is `@babel/eslint-parser`; version 7 accepts ESLint 7, 8 and 9, while version 8 requires ESLint 9 or 10, so the pull request picks 7 and adds `requireConfigFile: false` because the repository has no Babel config file.

### Will Prettier 3 reformat my code?

Where its defaults changed, yes. In this repository the only difference is a trailing comma after the last argument of a multi-line call in `index.js`, which `eslint . --fix` adds. Set `trailingComma: 'es5'` in `.prettierrc.js` to keep the old output; the pull request shows the change either way.

## More jobs like this: Fix a bug from an alert

- [Fix "TypeError: Descriptors cannot be created directly" in Python Protobuf](https://getrush.ai/run/fix-protobuf-descriptors-error/protobuf/)
- [Fix "Psych::BadAlias: Unknown alias" When Loading YAML on Ruby 3.1](https://getrush.ai/run/fix-psych-badalias-unknown-alias/psych/)
- [Fix "Psych::DisallowedClass: Tried to load unspecified class" on Ruby 3.1 and later](https://getrush.ai/run/fix-psych-disallowedclass-tried-to-load-unspecified-class/ruby/)
- [Fix "PydanticImportError: BaseSettings has been moved to the pydantic-settings package"](https://getrush.ai/run/fix-pydantic-basesettings-import-error/pydantic/)
- [Fix "PydanticUserError: `regex` is removed. use `pattern` instead" in Pydantic 2](https://getrush.ai/run/fix-pydantic-regex-is-removed/pydantic/)
- [Fix Pydantic V1 Style @validator Validators Are Deprecated in a FastAPI App](https://getrush.ai/run/fix-pydantic-v1-style-validator-deprecated-warning/pydantic/)

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