I think, this might have to do with this weird hackfix that is being touted in a bunch of places that tells you to place next/babel
in your eslint
config file for some reason (e.g. here).
It probably was a hackfix for an old bug in older next.js versions. But as of (at least) summer 2022, it makes little sense to do so, considering that next/babel
is a babel preset, not an eslint preset. Instead, in recent next.js versions, just reset your .eslintrc.json
:
{
"extends": [
"next"
]
}
With this setup, things don’t error out, as of [email protected].*
.
You also might want to take a look next’s eslint
customization options. For example, some people might be confused why eslint
is seemingly not working.
In that case, consider this solution and the next.js docs on eslint
.
If you have this problem, but you did not copy+paste your .eslintrc.json
from the interwebz, then you might need to describe your situation in more detail.