Skip to content

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.

RuleSettingFilesWhat it checksWhy
storybook/await-interactionserror**/*.stories.tsInteractions should be awaitedAn interaction (userEvent, expect) is awaited, or the test ends before it.
storybook/context-in-play-functionerror**/*.stories.tsPass a context when invoking play function of another storyA play function passes its context to the play function it calls.
storybook/csf-componentoff**/*.stories.tsThe component property should be setOff: a stories file may show several components, or none.
storybook/default-exportserror**/*.stories.tsStory files should have a default exportStorybook needs the default export (the meta) to index the file.
storybook/hierarchy-separatorerror**/*.stories.tsDeprecated hierarchy separator in title propertyDeprecated title syntax (|), fixed automatically.
storybook/meta-inline-propertiesoff**/*.stories.tsMeta should only have inline propertiesOff: style of the meta object.
storybook/meta-satisfies-typeoff**/*.stories.tsMeta should use satisfies MetaOff: style of the meta object.
storybook/no-redundant-story-nameoff**/*.stories.tsA story should not have a redundant name propertyOff: a redundant name is harmless.
storybook/no-renderer-packageserror**/*.stories.tsDo not import renderer packages directly in storiesThe framework package (@storybook/angular, @storybook/html-vite), not its renderer.
storybook/no-stories-oferror**/*.stories.tsstoriesOf is deprecated and should not be usedstoriesOf is removed from Storybook.
storybook/no-title-property-in-metaoff**/*.stories.tsDo not define a title in metaOff: an explicit title is allowed.
storybook/prefer-pascal-caseoff**/*.stories.tsStories should use PascalCaseOff: story names follow rules/naming, which allows PascalCase here.
storybook/story-exportserror**/*.stories.tsA story file must contain at least one story exportA stories file exports at least one story.
storybook/use-storybook-expecterror**/*.stories.tsUse expect from @storybook/test, storybook/test or @storybook/jestexpect from storybook/test, which the interaction panel records.
storybook/use-storybook-testing-libraryerror**/*.stories.tsDo not use testing-library directly on storiesuserEvent and queries from storybook/test, which the interaction panel records.
@typescript-eslint/naming-conventionwarn, [{"selector":"default","format":["camelCase"],"leadingUnd…**/*.stories.ts—Custom: story exports are PascalCase (export const Primary: Story), as Storybook names them.
@typescript-eslint/no-magic-numbersoff**/*.stories.ts—Off: story args are literal values.
storybook/no-uninstalled-addonserror, {"packageJsonLocation":"./package.json"}**/.storybook/*.tsThis 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-modulesoff**/.storybook/*.ts—Off: main.ts runs in Node.
import-x/no-default-exportoff**/*.stories.ts, **/.storybook/*.ts—Off: Storybook reads a default export (story meta, main.ts, preview.ts).
import-x/no-extraneous-dependencieserror, {"devDependencies":true,"packageDir":"."}**/*.stories.ts, **/.storybook/*.ts—Custom: stories and Storybook configs use devDependencies.

Generated from the JSDoc of the sources.