Skip to content

[Bug]: Storybook plugin not added to eslint.config during init in Next.js projects #32858

@valentinpalkovic

Description

@valentinpalkovic

Describe the bug

When initializing Storybook in a Next.js project, the setup modifies the eslint.config file to include an import for the Storybook ESLint plugin, but does not actually register the plugin in the ESLint configuration array.

Current generated eslint.config:

// 👇 only the import is added, but the plugin isn't added to the config
import storybook from "eslint-plugin-storybook";

import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

const eslintConfig = defineConfig([
  ...nextVitals,
  ...nextTs,
  // Override default ignores of eslint-config-next.
  globalIgnores([
    ".next/**",
    "out/**",
    "build/**",
    "next-env.d.ts",
  ]),
]);

export default eslintConfig;

Expected behaviour
Storybook’s init process should both:

  • Add the eslint-plugin-storybook import and
  • Extend the ESLint configuration with the Storybook plugin, e.g.:

Reproduction steps

  1. Create a new Next.js project (npx gitpick storybookjs/sandboxes/tree/next/nextjs-vite/default-ts/before-storybook)
  2. Run npx storybook@latest init
  3. Inspect the generated eslint.config.mjs (or eslint.config.mjs)

System

-

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions