storybookjs / eslint-plugin-storybook

🎗Official ESLint plugin for Storybook
MIT License
245 stars 52 forks source link

storybook/no-uninstalled-addons false positives for submodule #148

Open guilhermetod opened 8 months ago

guilhermetod commented 8 months ago

Describe the bug Potentially unwanted error report when using a submodule from a dependency.

Ie, if package.json had these packages:

{
    "@nx/react": "17.2.8",
    "@storybook/addon-essentials": "^7.5.3",
    "@storybook/addon-interactions": "^7.5.3",
}

We get a false positive as described below:

  addons: [
    '@storybook/addon-essentials',
    '@storybook/addon-interactions',
    '@nx/react/plugins/storybook', // This has an error
    '@nx/react', // This will not have an error, but it's incorrect path
  ],

Keep in mind that it's not possible to install @nx/react/plugins/storybook, so my suggestion if to check for partial dep match instead of full path.

To Reproduce Steps to reproduce the behavior:

  1. Start nx monorepo
  2. Add react application
  3. Set up storybook with nx generator
  4. Configure eslint-plugin-storybook with mentioned rule
  5. Check error on main.ts

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image