Skip to content

SB-2014: Remove remaining storiesOf detection leftovers - #36736

Merged
obvious-autobuild[bot] merged 2 commits into
nextfrom
feat/sb-2014-remove-storiesof-leftovers
Oct 13, 2026
Merged

obvious-autobuild[bot] merged 2 commits into
nextfrom
feat/sb-2014-remove-storiesof-leftovers

Conversation

@obvious-autobuild

@obvious-autobuild obvious-autobuild Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes SB-2014 (Linear)

What I did

The storiesOf runtime API was removed in Storybook 8.0 (PR #24655). What remained in the repo was not support code but the machinery that keeps storiesOf unsupported — plus dead fixtures and wording that no longer matches reality. This PR deletes the dead remainder and corrects the stale user-facing wording. It changes no detection behavior.

Why the detection stays (the title's literal reading, corrected): the CsfFile.parse() rejection is the only place a storiesOf file reaches users as a build failure — story indexing calls it with no local catch (core-server/presets/common-preset.ts:266-273, StoryIndexGenerator.ts:420), so deleting it would make legacy files index as zero stories, silently. The addon-docs csf-plugin catches are generic parse-error resilience keyed on the CSF: message prefix, which the throw never carried; the three ESLint hasStoriesOfImport skip-guards are pinned by their valid-case tests; and the upgrade-hierarchy-separators codemod is migration tooling whose input is legacy files by definition. None of these is dead code.

The one user-visible string change:

Before:
  Unexpected `storiesOf` usage: <location>.

  SB8 does not support `storiesOf`.

After:
  Unexpected `storiesOf` usage: <location>.

  `storiesOf` was removed in Storybook 8.0. Write stories in CSF instead.

Changes, in reading order:

  • code/__mocks__/inject-decorator.*.txt — deleted all 10 fixtures (354 lines). Zero references: git grep "inject-decorator" returns nothing.
  • docs/_snippets/storybook-migrate-stories-of-to-csf.md — deleted. Orphaned (zero references) and it recommended the storiesof-to-csf codemod, which no longer ships.
  • code/core/src/csf-tools/CsfFile.ts — message only: "SB8 does not support" → "was removed in Storybook 8.0". The Unexpected \storiesOf` usage:prefix is preserved (pinned by an unmodified test) and the message stays outside theCSF:` prefix namespace, so the csf-plugin still warns rather than going silent.
  • code/lib/eslint-plugin/src/rules/no-stories-of.ts + code/lib/eslint-plugin/docs/rules/no-stories-of.md + docs/configure/integration/eslint-plugin.mdx — "deprecated" → "removed in Storybook 8.0" wording everywhere (rule header, description, message, doc title, rule table); message id doNotUseStoriesOf unchanged.
  • code/lib/eslint-plugin/docs/rules/no-stories-of.md — replaced the dead link to lib/core/docs/storiesOf.md (does not exist anywhere in the repo) and the advice to run the removed storiesof-to-csf codemod with live pointers to the Storybook 8.0 migration guide and the CSF docs (both links verified to resolve).
  • code/addons/docs/src/csf-plugin/rollup-based-plugin.ts — comment only: no longer implies legacy storiesOf files are a supported input. The catch block's code is byte-identical to next.

Known gaps or risks

  • docs/frameworks.js:229-249 has a feature-matrix "storiesOf stories" entry pointing at the nonexistent lib/core/preview-api/storiesOf.md; an out-of-repo docs-site consumer could not be excluded, so this is left for the docs owners as a follow-up.
  • Remaining storiesof-to-csf mentions live only in historical CHANGELOG.v1-5.md / CHANGELOG.v6.md / MIGRATION.md records and are intentionally untouched.
  • No test currently executes the upgrade-hierarchy-separators fixtures at HEAD; the transform is byte-identical to next, and both storiesOf fixtures were verified to reproduce their snapshots by invoking the transform directly.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. yarn test csf-tools — CsfFile.test.ts passes unmodified, including the "storiesOf calls" test, which asserts that parsing still throws with the Unexpected \storiesOf` usage:` prefix.
  2. yarn test eslint-plugin — the no-stories-of rule still reports doNotUseStoriesOf (now with the "removed" wording), and the story-exports / default-exports / prefer-pascal-case valid-case fixtures (storiesOf files) stay silent, proving the skip-guards are untouched.
  3. yarn test codemod — the codemod suite passes with the upgrade-hierarchy-separators storiesOf fixtures and snapshots untouched.
  4. To see the new parser message end to end: in a project running this branch, add a .stories.js file that calls storiesOf('X', module) and start Storybook — the index build fails with Unexpected \storiesOf` usage: . `storiesOf` was removed in Storybook 8.0. Write stories in CSF instead.`
  5. git grep "inject-decorator" and git grep "storiesof-to-csf" docs/ return no matches, confirming the dead fixtures and the removed-codemod advice are gone.
  6. Areas most likely to regress and worth extra scrutiny: story indexing of CSF files (should be unchanged — the throw only fires on storiesOf(...) calls) and the csf-plugin warning behavior for unparseable .stories files (should still warn, not go silent).

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

Test changes: deleted .txt files are dead fixture mocks with zero references, not tests; no test file, assertion, or snapshot was modified

Visual evidence: not applicable - backend/docs-only cleanup; the user-visible changes are CLI/log strings and deleted fixture files, nothing renders differently

🔗 Obvious Project · 🧵 Obvious Thread · 🔀 Obvious PR Artifact

The runtime storiesOf API was removed in Storybook 8.0; what remained was
the detection that refuses legacy files (kept here untouched), plus dead
fixtures and wording that still said "deprecated" or "SB8 does not
support".

- Delete the 10 zero-reference `code/__mocks__/inject-decorator.*.txt`
  fixtures (354 lines) and the orphaned
  `docs/_snippets/storybook-migrate-stories-of-to-csf.md` snippet, which
  recommended the `storiesof-to-csf` codemod that no longer ships.
- Reword the CsfFile.parse() storiesOf rejection to say storiesOf was
  removed in Storybook 8.0, keeping the `Unexpected \`storiesOf\` usage:`
  prefix (pinned by CsfFile.test.ts).
- Reword the no-stories-of ESLint rule (header, description, message;
  id `doNotUseStoriesOf` unchanged), the rule doc title, and the
  eslint-plugin docs rule table in lockstep.
- Replace the rule doc's dead link to `lib/core/docs/storiesOf.md` and
  its advice to run the removed `storiesof-to-csf` codemod with live
  pointers to the Storybook 8.0 migration guide and CSF docs.
- Reword the addon-docs csf-plugin comment that implied legacy
  storiesOf files are a supported input. Code behavior unchanged.

No detection behavior changes: the parser throw, both csf-plugin catch
blocks, the three ESLint skip-guards, and the
upgrade-hierarchy-separators codemod keep their behavior.
@obvious-autobuild obvious-autobuild Bot added cleanup Minor cleanup style change that won't show up in release changelog ci:normal Run our default set of CI jobs (choose this for most PRs). qa:skip Pull Requests that do not need any QA. (e.g. documentation) labels Oct 12, 2026
…ved-in-8.0 wording

Review follow-up for #36736: the test @file header and the package README's
generated-shape rule row still said "deprecated". Reworded to the canonical
"storiesOf was removed in Storybook 8.0; use CSF instead." string produced by
scripts/update-rules-list.ts (verified by running it: zero diff in the
generator-owned eslint-plugin.mdx table).
@obvious-autobuild
obvious-autobuild Bot marked this pull request as ready for review October 12, 2026 15:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T15:42:35.556116Z 127719a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@obvious-autobuild
obvious-autobuild Bot merged commit b573fcf into next Oct 13, 2026
149 checks passed
@obvious-autobuild
obvious-autobuild Bot deleted the feat/sb-2014-remove-storiesof-leftovers branch October 13, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). cleanup Minor cleanup style change that won't show up in release changelog qa:skip Pull Requests that do not need any QA. (e.g. documentation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants