Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nextjs): ensure eslint-config-next matches Next.js 14 and 15 versions #30259

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tuffz
Copy link
Contributor

@tuffz tuffz commented Mar 4, 2025

This PR builds on the previous fix that ensured eslint-config-next was correctly installed when using Next.js 15. #30258

Now, the logic has been further refined to dynamically determine the installed Next.js version and install the corresponding eslint-config-next version accordingly.

Current Behavior

Expected Behavior

If Next.js 15 is detected -> [email protected] is installed
If Next.js 14 is detected -> [email protected] is installed

GitHub Repo

https://github.com/tuffz/new-nx-with-preset-nextjs

Steps to Reproduce

  1. Run the following command from the official documentation:
    npx create-nx-workspace@latest --preset=next
  2. Open package.json and check the installed dependencies

Related Issue(s)

Fixes #30257 (& #30258)

@tuffz tuffz requested a review from a team as a code owner March 4, 2025 15:08
@tuffz tuffz requested a review from mandarini March 4, 2025 15:08
Copy link

vercel bot commented Mar 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Mar 4, 2025 3:33pm

Copy link

nx-cloud bot commented Mar 4, 2025

View your CI Pipeline Execution ↗ for commit 89d30b2.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 28m 16s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 13s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check --base=c698b... ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 1s View ↗
nx documentation ✅ Succeeded 59s View ↗

☁️ Nx Cloud last updated this comment at 2025-03-04 16:05:14 UTC

tuffz added 2 commits March 4, 2025 16:27
The `create-nx-workspace` command with the Next.js preset currently installs `next@15` but
incorrectly adds `eslint-config-next@14`, leading to potential ESLint compatibility issues.

This fix ensures that `eslint-config-next@15` is installed when using Next.js 15.
…on for Next.js 14 and 15

Enhanced the logic to determine the installed Next.js version and ensure the appropriate
`eslint-config-next` devDependency is added accordingly:

- Next.js 15 - `eslint-config-next@15`
- Next.js 14 - `eslint-config-next@14`

This further refines the previous fix by dynamically selecting the correct ESLint configuration,
preventing potential compatibility issues.
@tuffz tuffz force-pushed the fix-next-eslint-config-based-on-nextjs-version branch from 7560de3 to 89d30b2 Compare March 4, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eslint-config-next version mismatch in Nx Workspace setup with NextJS preset
1 participant