Open silvenon opened 4 days ago
@silvenon It is on our to-do list! We have not added it to create-next-app
yet since I believe there are a few improvements to be done (e.g., I believe using flat config looks funky right now versus the old config).
Nonetheless, ESLint v9 is fully supported in v15.
Is there any example of how a flat config for v9 could look like (with vitals & next config with typescript) ? There are some hacky solutions out there from before the official support, but can't find anything new after the release.
Is there any example of how a flat config for v9 could look like (with vitals & next config with typescript) ? There are some hacky solutions out there from before the official support, but can't find anything new after the release.
I ended up using the solution outlined here on the ESLint docs. Not sure if there's a better solution currently, but it works for me in VS Code and when running next
commands.
// eslint.config.mjs
import { FlatCompat } from "@eslint/eslintrc"
import path from "path"
import { fileURLToPath } from "url"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
})
/** @type {import('eslint').Linter.Config[]} */
const configs = [
...compat.extends("next/core-web-vitals"),
...compat.extends("next/typescript"),
]
export default configs
This should work
import nextPlugin from "@next/eslint-plugin-next";
export default [
{
name: "Next Plugin",
plugins: {
"@next/next": nextPlugin,
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
},
},
},
];
Link to the code that reproduces this issue
https://github.com/silvenon/repro/tree/nextjs-v15-eslint-v8
To Reproduce
npx create-next-app@latest
Current vs. Expected behavior
Currently it installs ESLint v8, but I expected v9 considering that Next.js v15 says that it supports v9. Did I misunderstand what that meant?
Provide environment information
Which area(s) are affected? (Select all that apply)
create-next-app, Linting
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
No response