Eslint 9 for v15
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
Does eslint-config-next work for eslint 9? I'm looking at the files and it only seems to support the rc format, but the post for the update says its updated for eslint 9
33 Replies
Golden northern bumble bee
also running into this @Multiflora rose seed chalcid
any fix you found? I think I am going to go back to eslint 8
Snail Kite
I just tested creating a new project and upgrading to ESLint 9, and it seems to work fine for me.
Golden northern bumble bee
@Snail Kite are you using the eslint config next?
Snail Kite
It's in the configs, but perhaps I should take a closer look at one of the specific rules to make sure it runs
Golden northern bumble bee
Snail Kite
Uh, but I think I am, because I did test the missing alt tag on Image
Golden northern bumble bee
This is how the eslint docs say to do it, what are you doing?
Snail Kite
I used the migrate script
npx @eslint/migrate-script .eslintrc.json
It produced a rather ugly config but
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export default [...compat.extends("next/core-web-vitals", "next/typescript")];
Golden northern bumble bee
this is giving me a 404 for some reason
npx @eslint/migrate-config .eslintrc.json
I think its config
Snail Kite
Typed it from memory, lemme check if I did it wrong
Golden northern bumble bee
Yeah just barely off
haha no worries
lets see if it works
Snail Kite
Ah, yeah mb
Golden northern bumble bee
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [...compat.extends("next")];
For all of the config this is what I got
(not just web vitals, etc)
damn this is ugly but I guess it works lol
Snail Kite
I used the default .eslintrc.json from Next, which looks like this
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
Golden northern bumble bee
Ah ok cool
makes sense
Snail Kite
I'm assuming some defaults change every now and then in case you're using a project that was created some time ago :P
Strangely enough the only thing that ESLint actually complains about is from the generated eslint config itself, about exporting anonymous arrays
I'm sure it can be cleaned up somewhat though to correct it
I wrote up my exact steps btw in case for reproduction
# using all defaults (named it next-15-eslint)
npx create-next-app@latest
cd next-15-eslint
npm install eslint@latest
npx @eslint/migrate-config .eslintrc.json
npm install @eslint/js @eslint/eslintrc -D
At long last there are no screaming warnings about deprecated code on every install
The reason I came here was actually to check if there was a reason why v9 wasn't default for Next 15, but perhaps this support is freshly out the oven