-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Closed
Labels
LintingRelated to `next lint` or ESLint with Next.js.Related to `next lint` or ESLint with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.
Description
Link to the code that reproduces this issue
https://github.com/divergex/divergex.github.io
To Reproduce
Setup project with next, add Eslint and setup with pnpm create @eslint/config@latest
Then, run next lint
eslint.config.mjs
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
/** @type {import('eslint').Linter.Config[]} */
export default [
{
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
},
{
languageOptions: {
globals: globals.browser,
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
];
gives ⚠ The Next.js plugin was not detected in your ESLint configuration.
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import pluginNext from "@next/eslint-plugin-next";
/** @type {import('eslint').Linter.Config[]} */
export default [
{
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
},
{
languageOptions: {
globals: globals.browser,
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
pluginNext.configs.recommended,
];
gives Config (unnamed): Key "plugins": This appears to be in eslintrc format (array of strings) rather than flat config format (object).
and pluginNext isn't iterable neither has a flat attribute.
Current vs. Expected behavior
Current behavior is that next lint
fails, and expected behaviour obviously is that it should work with the correct format.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Wed Sep 25 07:09:20 UTC 2024 (b87e886)
Available memory (MB): 31961
Available CPU cores: 16
Binaries:
Node: 20.18.0
npm: 10.8.2
Yarn: N/A
pnpm: 9.14.4
Relevant Packages:
next: 15.0.3 // Latest available version is detected (15.0.3).
eslint-config-next: 15.0.3
react: 18.3.1
react-dom: 18.3.1
typescript: 5.7.2
Next.js Config:
output: export
Which area(s) are affected? (Select all that apply)
Linting
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
TheeKia, will-banked, Mrtly, kachkaev, rzimmerdev and 4 more
Metadata
Metadata
Assignees
Labels
LintingRelated to `next lint` or ESLint with Next.js.Related to `next lint` or ESLint with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.