ESLint error on NextJs v15.5.4 with 'next/core-web-vitals' - TypeError: Converting circular structure to JSON #84596
Replies: 2 comments 2 replies
-
|
I think the error happens because |
Beta Was this translation helpful? Give feedback.
-
|
Answer to: "ESLint error on NextJs v15.5.4 with 'next/core-web-vitals' - TypeError: Converting circular structure to JSON" Hello! This circular structure error occurs because Option 1: Use ESLint Flat Config Without Compat Layer // eslint.config.mjs
import next from '@next/eslint-plugin-next';
export default [
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: {
'@next/next': next,
},
rules: {
...next.configs.recommended.rules,
...next.configs['core-web-vitals'].rules,
},
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
rules: {
'react-hooks/exhaustive-deps': 'error',
},
},
];Option 2: Minimal FlatCompat Approach // eslint.config.mjs
import { FlatCompat } from '@eslint/eslintrc';
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
export default [
{
ignores: ['.next/**', 'node_modules/**'],
},
...compat.extends('next/typescript'),
{
files: ['**/*.{js,jsx,ts,tsx}'],
rules: {
'@next/next/no-html-link-for-pages': 'error',
'@next/next/no-before-interactive-script-outside-document': 'error',
'@next/next/no-sync-scripts': 'error',
'@next/next/no-page-custom-font': 'error',
'react-hooks/exhaustive-deps': 'error',
},
},
];Option 3: Use Next.js Built-in ESLint (Recommended) // package.json
{
"scripts": {
"lint": "next lint"
}
}The root cause is that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
with
eslint.config.mjsif I detele
next/core-web-vitalsit's work finehttps://stackblitz.com/edit/stackblitz-starters-ftmr4o9w?file=package.json
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions