Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/peaceful-snow-forked-4gz2ym
To Reproduce
I've spun this issue off from #82187. There are several problems around the build and types for eslint-plugin-next, and I want to be clear about this specific problem: There's currently no possible way to import eslint-plugin-next in an eslint.config.mjs that both 1) correctly imports the recommended flat config and 2) does not raise TypeScript errors if the config is type checked.
A secondary issue is that the docs for the plugin are out of date, using FlatCompat rather than importing the flat configuration added by #73873 directly.
All I've done to set up the sandbox project is:
- Followed the official typescript-eslint start guide to create an initial
eslint.config.mjs
- Installed
@next/eslint-plugin-next@15.4.5
Current vs. Expected behavior
Any attempt to use the flatConfig.recommended configuration added by #73873 will trigger an ESLint error, a TypeScript error, or both:
Default import
import eslintPluginNext from "@next/eslint-plugin-next";
...
eslintPluginNext.flatConfig.recommended // TypeScript error
Named import
import { flatConfig } from "@next/eslint-plugin-next";
...
flatConfig.recommended // ESLint error and TypeScript error
Namespace import
import * as eslintPluginNext from "@next/eslint-plugin-next";
...
eslintPluginNext.flatConfig.recommended // ESLint error and TypeScript error
The expected behavior is that there should be an approach to importing flat configurations that both works and satisfies the type checker.
Provide environment information
Relevant packages:
eslint-plugin-next: 15.4.5
Which area(s) are affected? (Select all that apply)
Linting
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
With the deprecation of next lint in Next 15.5, this issue is likely to affect more users in the near future, as many will be migrating to maintaining their own eslint.config.mjs.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/peaceful-snow-forked-4gz2ym
To Reproduce
I've spun this issue off from #82187. There are several problems around the build and types for eslint-plugin-next, and I want to be clear about this specific problem: There's currently no possible way to import eslint-plugin-next in an
eslint.config.mjsthat both 1) correctly imports the recommended flat config and 2) does not raise TypeScript errors if the config is type checked.A secondary issue is that the docs for the plugin are out of date, using
FlatCompatrather than importing the flat configuration added by #73873 directly.All I've done to set up the sandbox project is:
eslint.config.mjs@next/eslint-plugin-next@15.4.5Current vs. Expected behavior
Any attempt to use the
flatConfig.recommendedconfiguration added by #73873 will trigger an ESLint error, a TypeScript error, or both:Default import
Named import
Namespace import
The expected behavior is that there should be an approach to importing flat configurations that both works and satisfies the type checker.
Provide environment information
Which area(s) are affected? (Select all that apply)
Linting
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
With the deprecation of
next lintin Next 15.5, this issue is likely to affect more users in the near future, as many will be migrating to maintaining their owneslint.config.mjs.