eslint/rules/storybook
Storybook (any framework: Angular, HTML + Vite…), kept light: the rules that catch a story that breaks or a test that lies, and the relaxations stories need (default export, PascalCase story names, devDependencies). The style rules of the plugin are off: stories are documentation, not a place to argue about form.
21 rules, 12 on. Source: lint/eslint/rules/storybook.mjs.
| Rule | Setting | Files | What it checks | Why |
|---|---|---|---|---|
storybook/await-interactions | error | **/*.stories.ts | Interactions should be awaited | An interaction (userEvent, expect) is awaited, or the test ends before it. |
storybook/context-in-play-function | error | **/*.stories.ts | Pass a context when invoking play function of another story | A play function passes its context to the play function it calls. |
storybook/csf-component | off | **/*.stories.ts | The component property should be set | Off: a stories file may show several components, or none. |
storybook/default-exports | error | **/*.stories.ts | Story files should have a default export | Storybook needs the default export (the meta) to index the file. |
storybook/hierarchy-separator | error | **/*.stories.ts | Deprecated hierarchy separator in title property | Deprecated title syntax (|), fixed automatically. |
storybook/meta-inline-properties | off | **/*.stories.ts | Meta should only have inline properties | Off: style of the meta object. |
storybook/meta-satisfies-type | off | **/*.stories.ts | Meta should use satisfies Meta | Off: style of the meta object. |
storybook/no-redundant-story-name | off | **/*.stories.ts | A story should not have a redundant name property | Off: a redundant name is harmless. |
storybook/no-renderer-packages | error | **/*.stories.ts | Do not import renderer packages directly in stories | The framework package (@storybook/angular, @storybook/html-vite), not its renderer. |
storybook/no-stories-of | error | **/*.stories.ts | storiesOf is deprecated and should not be used | storiesOf is removed from Storybook. |
storybook/no-title-property-in-meta | off | **/*.stories.ts | Do not define a title in meta | Off: an explicit title is allowed. |
storybook/prefer-pascal-case | off | **/*.stories.ts | Stories should use PascalCase | Off: story names follow rules/naming, which allows PascalCase here. |
storybook/story-exports | error | **/*.stories.ts | A story file must contain at least one story export | A stories file exports at least one story. |
storybook/use-storybook-expect | error | **/*.stories.ts | Use expect from @storybook/test, storybook/test or @storybook/jest | expect from storybook/test, which the interaction panel records. |
storybook/use-storybook-testing-library | error | **/*.stories.ts | Do not use testing-library directly on stories | userEvent and queries from storybook/test, which the interaction panel records. |
@typescript-eslint/naming-convention | warn, [{"selector":"default","format":["camelCase"],"leadingUnd… | **/*.stories.ts | — | Custom: story exports are PascalCase (export const Primary: Story), as Storybook names them. |
@typescript-eslint/no-magic-numbers | off | **/*.stories.ts | — | Off: story args are literal values. |
storybook/no-uninstalled-addons | error, {"packageJsonLocation":"./package.json"} | **/.storybook/*.ts | This rule identifies storybook addons that are invalid because they are either not installed or contain a typo in their name. | Custom: addons are installed in the given package.json. |
import-x/no-nodejs-modules | off | **/.storybook/*.ts | — | Off: main.ts runs in Node. |
import-x/no-default-export | off | **/*.stories.ts, **/.storybook/*.ts | — | Off: Storybook reads a default export (story meta, main.ts, preview.ts). |
import-x/no-extraneous-dependencies | error, {"devDependencies":true,"packageDir":"."} | **/*.stories.ts, **/.storybook/*.ts | — | Custom: stories and Storybook configs use devDependencies. |