Skip to content

New ESLint "flat" configuration file does not work with next/core-web-vitals #64114

Closed
@hb20007

Description

@hb20007

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/pensive-star-go8s7s

To Reproduce

  1. Run npm run dev and observe the error showing that ...compat.extends("next/core-web-vitals") does not work.

Current vs. Expected behavior

Current behavior: It is impossible to use the new ESLint "flat config" in a Next.js project (due to next/core-web-vitals).

Expected behavior: It should work.

Which area(s) are affected? (Select all that apply)

ESLint (eslint-config-next)

Additional context

In case it is not clear, I have imported ...compat.extends("next/core-web-vitals") in page.tsx only for the purpose of showing that it does not work. The file with the actual ESLint configuration is eslint.config.js.

I have followed the official ESLint Configuration Migration Guide, where it is mentioned that FlatCompat should be used for an npm package which is in eslintrc format. In this case, I believe that the problem is that next/core-web-vitals is not an npm package. I also tried ...compat.extends("eslint-config-next"), but that does not work either.

For extra context, ESLint is moving from .eslintrc.json to eslint.config.js, and all other shareable ESLint configs I am using (e.g., typescript-eslint, eslint-config-prettier) already support this, even without needing to use FlatCompat.

NEXT-3293

Metadata

Metadata

Assignees

No one assigned

    Labels

    LintingRelated to `next lint` or ESLint with Next.js.bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions