Skip to content

ESLint crashes when eslint-plugin-storybook is not installed #47

@haljac

Description

@haljac

Problem

Running npm run lint fails with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'eslint-plugin-storybook'
imported from eslint.config.js

eslint.config.js uses a static import for eslint-plugin-storybook. If the package isn't in node_modules, ESLint completely crashes — it can't even lint non-Storybook files.

Root Cause

  • eslint-plugin-storybook and other Storybook dependencies were added to package.json in commit dbed07d
  • Developers who had node_modules from before that commit never re-ran npm install
  • Worktrees start with empty node_modules, so they always hit this
  • CI is unaffected (runs npm ci which installs everything)

Fix

Make the Storybook ESLint plugin a graceful optional dependency using dynamic import() with a try/catch fallback. If the package isn't installed, ESLint should skip Storybook rules but still work for everything else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions