Config for projects using Storybook for UI components.
-
If you haven't already, make sure to install
@code-pushup/eslint-config
and its required peer dependencies. -
Since this plugin requires additional peer dependencies, you have to install them as well:
npm install -D eslint-plugin-storybook
-
Add to your
eslint.config.js
file:import storybook from '@code-pushup/eslint-config/storybook.js'; import tseslint from 'typescript-eslint'; export default tseslint.config(...storybook);
🔧 Automatically fixable by the
--fix
CLI option.
💡 Manually fixable by editor suggestions.
🧪🚫 Disabled for test files.
🧪⚠️ Severity lessened to warning for test files.
Plugin | Rule | Options | Autofix | Overrides |
---|---|---|---|---|
![]() |
await-interactions Interactions should be awaited |
🔧, 💡 | ||
![]() |
context-in-play-function Pass a context when invoking play function of another story |
|||
![]() |
default-exports Story files should have a default export |
🔧, 💡 | ||
![]() |
no-uninstalled-addons This rule identifies storybook addons that are invalid because they are either not installed or contain a typo in their name. |
|||
![]() |
story-exports A story file must contain at least one story export |
|||
![]() |
use-storybook-expect Use expect from @storybook/test or @storybook/jest |
🔧 | ||
![]() |
use-storybook-testing-library Do not use testing-library directly on stories |
🔧, 💡 |
Plugin | Rule | Options | Autofix | Overrides |
---|---|---|---|---|
![]() |
csf-component The component property should be set |
|||
![]() |
hierarchy-separator Deprecated hierarchy separator in title property |
🔧, 💡 | ||
![]() |
no-redundant-story-name A story should not have a redundant name property |
🔧, 💡 | ||
![]() |
prefer-pascal-case Stories should use PascalCase |
🔧, 💡 |