docs(swc): retire story-level JSDoc, description-only tag, and section-order parameter#6352
Conversation
…time With per-unit MDX as the source of truth for docs page layout, the description-only tag and section-order parameter workarounds are no longer needed. - SpectrumStories.tsx: drop the description-only branch (Canvas is now always rendered for tagged stories) and the section-order sort (stories render in definition order; ordering is hand-authored in MDX). - validate-story-tags.js: remove description-only from the allowed-tags allowlist. The retired patterns are documented in the corresponding rule and skill updates landing alongside this commit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rework stories-format.md and related Phase 5 / contributor-docs guidance to reflect the per-unit MDX model: the stories file is definitions-only; story-level JSDoc is not authored; section ordering and prose-only sections live in MDX. stories-format.md: - Frontmatter and scope now cover components, patterns, and controllers - New "Source of truth: per-unit MDX, not JSDoc" section names the MDX location per genre and clarifies that only the meta-level JSDoc is retained - Required tags: drop autodocs from Playground when a per-unit MDX exists (avoids duplicate Docs entries); add controller for the controller meta tag - Story types (Playground, Overview, Anatomy, Options, States, Behaviors, Accessibility): drop story-level JSDoc requirements and examples; redirect prose to MDX - Do/Don't and checklist updated to match migration-styling/SKILL.md and stories-template.md: - Phase 5 scope is now "scaffold the stories file with no story-level JSDoc"; Phase 7 authors the per-component MDX - Template drops section-order params CONTRIBUTOR-DOCS Phase 4 step: - Playground guidance: omit autodocs when an MDX file exists - Options guidance: section ordering is hand-authored in MDX Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Flip stories-documentation.md from "what to put in JSDoc above stories"
to "what to author in the per-unit MDX". Add genre coverage so the rule
applies to components, internal components, patterns, and controllers.
Update code-conformance.md storybook checks to verify both surfaces
(stories file and per-unit MDX).
stories-documentation.md:
- New "Authoring surface: per-unit MDX" section at the top, with file
template, canonical section order, genre-specific notes table (MDX
path, blocks import path, Anatomy section presence, ApiTable branch
for DocsFooter, production-build inclusion)
- Per-story title rules (PascalCase -> Title Case, storyName override)
and single-story-section subheading guidance
- Untagged-stories-do-not-render guidance to prevent surfacing content
production excludes
- Existing section patterns reframed: prose lives in MDX under each
## Section / ### Story Title heading, not in JSDoc above stories
- Component-linking guidance covers both meta JSDoc and MDX prose
- MDX heading-level convention (h2 sections, h3 stories, h4+ inside
prose), replacing the previous JSDoc heading-level rule
- Checklist split into Stories file vs Per-unit MDX vs Cross-checks
code-conformance.md:
- Storybook section now checks both the stories file (no story-level
JSDoc, no section-order, no description-only, drop autodocs from
Playground when MDX exists) and the per-unit MDX (file exists at
unit root, Meta of={Stories} declared once, DocsHeader/DocsFooter
placement, canonical section order, every section-tagged story
surfaced via Canvas, controller-API hand-authoring branch)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 7 of the migration workflow now authors the per-component MDX file as the docs surface, not story-level JSDoc. migration-documentation/SKILL.md: - Goal updated: per-component MDX docs page + public-API JSDoc on Component.ts. Story-level JSDoc is not authored. - Mindset clarified: meta-level JSDoc is retained (drives Description); prose lives in MDX. - Workflow Step 2 (Phase 5 scaffold check) and Step 3 (write story JSDoc) reworked to author the per-component MDX and add the Accessibility prose to ## Accessibility. The Upcoming features pattern points to MDX prose-only sections rather than description-only story exports. - "What NOT to include" gains a new "Story-level JSDoc" prohibition at the top; renamed and rebranded from "stories JSDoc" to "MDX or JSDoc" so it covers both surfaces consistently. documentation/SKILL.md: - "When to Use" lists MDX docs pages and Component.ts JSDoc explicitly; drops the dated "story JSDoc" framing. - "Key patterns" calls out the three doc surfaces in 2nd-gen (per-unit MDX, public-API JSDoc, meta-level JSDoc) and links to the per-unit MDX authoring rule. .ai/README.md: - Migration phase 7 summary updated to "author the per-component MDX + finalize Storybook stories + public-API JSDoc". - Documentation skill summary covers MDX, public-API JSDoc, meta-level JSDoc, and traditional markdown surfaces. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
|
I have read through all the proposed changes and agree with them. The updates are the context so nothing to add self review wise. |
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Description
Final cleanup in the JSDoc-to-MDX conversion chain. Now that components, patterns, and controllers all author their docs page in per-unit MDX (PRs #6349 and #6351), retire the workarounds that JSDoc-on-stories required, and rewrite the authoring rules and migration skills so future contributors learn the new pattern.
This branch is based on
caseyisonit/docs-mdx-patterns(SWC-2230). Merge that PR first; this PR depends on it.Scope:
SpectrumStories.tsxdrops thedescription-onlybranch and thesection-ordersort.validate-story-tags.jsremovesdescription-onlyfrom the allowed-tags allowlist..ai/rules/stories-format.md, contributor-docs Phase 4 step,migration-stylingskill + template): the stories file is definitions-only. No story-level JSDoc above story exports.Playgroundusestags: ['dev'](no'autodocs') when a per-unit MDX exists. Genre coverage extended to patterns and controllers..ai/rules/stories-documentation.md): reframed from "what to put in JSDoc above stories" to "what to author in the per-unit MDX". New sections cover the per-unit MDX file template, canonical section order, genre-specific table (MDX path, blocks import path, ApiTable branch forDocsFooter, production-build inclusion), per-story title rules (PascalCase → Title Case,storyNameoverride), single-story-section guidance, and untagged-stories-do-not-render warning..ai/rules/code-conformance.md): storybook checks now cover both surfaces. Stories file: no story-level JSDoc, nosection-order, nodescription-only, correct Playground tags. Per-unit MDX: file exists,<Meta of={Stories} />declared once,<DocsHeader />/<DocsFooter />placement, canonical section order, every section-tagged story surfaced via<Canvas>, controller-API hand-authoring branch.migration-documentation/SKILL.md): Phase 7 now authors the per-component MDX docs page + public-API JSDoc onComponent.ts. The Upcoming features pattern moves to MDX prose-only sections.documentation/SKILL.md,.ai/README.md): documentation skill and AI README reflect MDX as the primary 2nd-gen docs surface.Motivation and context
With per-unit MDX as the docs surface, the runtime workarounds —
description-only(suppressing Canvas under JSDoc-only stories) andsection-order(sorting stories inside a tag-rendered section) — are no longer needed. Removing them simplifiesSpectrumStories.tsxand prevents future contributors from reaching for the retired patterns.The rule and skill rewrites are the more impactful piece: they teach the new pattern to humans and AI agents authoring docs for new units. Without these updates, contributors would continue authoring story-level JSDoc by following the existing rules, which would no longer match how the docs page actually renders.
Related issue(s)
Screenshots (if appropriate)
N/A — runtime behavior for converted units is unchanged (the dropped logic was unreachable after SWC-2230). Storybook should render identically.
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
No remaining
description-onlyorsection-orderusage in 2nd-gengrep -rn "description-only\\|'section-order'" 2nd-gen/packages/ | grep -v node_modulesDocs pages still render
yarn storybookin2nd-gen/packages/swc//docs/components-badge--docs,/docs/patterns-conversational-ai-system-message--docs,/docs/core-controllers-focus-group-navigation-controller--docs)Updated rules describe the new pattern
.ai/rules/stories-format.mdand.ai/rules/stories-documentation.mdMigration-documentation skill targets MDX
.ai/skills/migration-documentation/SKILL.mdComponent.tsremains as the second surface.Device review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps.
Keyboard (required — document steps below)
Screen reader (required — document steps below)