eslint / eslint/create-config

Bug: Adding react support causes peer dependency conflict

Open
#248 3 comments 0 reactions 1 assignee Claimed by @danielisgr8 View on GitHub
bug
Dominant language
JavaScript
Stars
103
Forks
31
Avg merge
1h 34m
Merged PRs (30d)
3

Description

### Environment

Node version: 20.20.0
npm version: 11.17.0
@eslint/create-config version: 2.0.0
Operating System: Ubuntu 22.04.5

### What did you do?

I ran `npm init @eslint/config@latest` with the following configuration:

```
@eslint/create-config: v2.0.0
✔ What do you want to lint? · javascript
✔ How would you like to use ESLint? · problems
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · No / **Yes**
✔ Where does your code run? · browser
✔ Which language do you want your configuration file be written in? · ts
ℹ Jiti is required for Node.js <24.3.0 to read TypeScript configuration files.
✔ Would you like to add Jiti as a devDependency? · No / **Yes**
ℹ The config that you've selected requires the following dependencies:

eslint, @eslint/js, globals, typescript-eslint, eslint-plugin-react, jiti
✔ Would you like to install them now? · No / **Yes**
✔ Which package manager do you want to use? · npm
```

### What did you expect to happen?

Installation succeeds and eslint is set up correctly

### What actually happened?

This caused a peer dependency failure because the script attempted to install eslint 10 while eslint-plugin-react only support up to v9:

```
npm error While resolving: @danielisgr8/personal-website@1.0.0
npm error Found: eslint@10.5.0
npm error node_modules/eslint
npm error dev eslint@"*" from the root project
npm error peerOptional eslint@"^10.0.0" from @eslint/js@10.0.1
npm error node_modules/@eslint/js
npm error dev @eslint/js@"*" from the root project
npm error
npm error Could not resolve dependency:
npm error dev eslint-plugin-react@"*" from the root project
npm error
npm error Conflicting peer dependency: eslint@9.39.4
npm error node_modules/eslint
npm error peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" from eslint-plugin-react@7.37.5
npm error node_modules/eslint-plugin-react
npm error dev eslint-plugin-react@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
```

### Link to Minimal Reproducible Example

Not sure if this is relevant since it's all CLI interaction? Let me know.

### Participation

- [x] I am willing to submit a pull request for this issue.

### AI acknowledgment

- [x] I did not use AI to generate this issue report.
- [ ] (If the above is not checked) I have reviewed the AI-generated content before submitting.

### Additional comments

Perhaps this could be fixed by allowing the user to hardcode a particular version? E.g. `npm init @eslint/config@latest --eslint-major-version=9`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.