Skip to content

docs: Add 2nd-gen TypeScript style guide and Storybook docs automation#6067

Merged
caseyisonit merged 26 commits intomainfrom
caseyisonit/typescript-guide
Mar 30, 2026
Merged

docs: Add 2nd-gen TypeScript style guide and Storybook docs automation#6067
caseyisonit merged 26 commits intomainfrom
caseyisonit/typescript-guide

Conversation

@caseyisonit
Copy link
Copy Markdown
Contributor

@caseyisonit caseyisonit commented Mar 6, 2026

Description

Adds a comprehensive TypeScript style guide for 2nd-gen component development and automates publishing contributor docs to Storybook.

Motivation and context

Contributors (human and AI) need clear, consistent guidance for writing 2nd-gen components. This PR provides detailed conventions for file organization, class structure, decorators, types, and composition patterns—all based on the Badge component as the reference implementation.

Additionally, contributor docs are now automatically converted and displayed within Storybook, making them easier to discover and browse alongside component documentation.

NOTE: The generate contributor docs script is TEMPORARY and will be re-evaluated when we address the documentation information architecture. For the time being this will allow us to review and read contributor docs in storybook

Related issue(s)

  • fixes [SWC-1420]

Screenshots (if appropriate)

N/A - documentation changes

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Verify TypeScript guide renders correctly in Storybook

    1. Run yarn storybook in 2nd-gen/packages/swc
    2. Navigate to the Contributor Docs section
    3. Confirm the TypeScript style guide pages load and display properly
  • Verify navigation structure is accurate

    1. Open CONTRIBUTOR-DOCS/02_style-guide/02_typescript/README.md
    2. Confirm all 15 linked guides exist and have correct content

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Summary of changes:

Area Files Description
TypeScript style guide 15 new docs File organization, class structure, decorators, types, composition patterns
Storybook automation generate-contributor-docs.mjs Converts markdown docs to MDX for Storybook display
Minor fixes Badge, sized mixin Small updates aligned with documented patterns

@caseyisonit caseyisonit requested a review from a team as a code owner March 6, 2026 19:40
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 6, 2026

🦋 Changeset detected

Latest commit: 86d7e28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 85 packages
Name Type
@spectrum-web-components/base Minor
@spectrum-web-components/core Minor
@spectrum-web-components/accordion Minor
@spectrum-web-components/action-bar Minor
@spectrum-web-components/action-button Minor
@spectrum-web-components/action-group Minor
@spectrum-web-components/action-menu Minor
@spectrum-web-components/alert-banner Minor
@spectrum-web-components/alert-dialog Minor
@spectrum-web-components/asset Minor
@spectrum-web-components/avatar Minor
@spectrum-web-components/badge Minor
@spectrum-web-components/breadcrumbs Minor
@spectrum-web-components/button-group Minor
@spectrum-web-components/button Minor
@spectrum-web-components/card Minor
@spectrum-web-components/checkbox Minor
@spectrum-web-components/clear-button Minor
@spectrum-web-components/close-button Minor
@spectrum-web-components/coachmark Minor
@spectrum-web-components/color-area Minor
@spectrum-web-components/color-field Minor
@spectrum-web-components/color-handle Minor
@spectrum-web-components/color-loupe Minor
@spectrum-web-components/color-slider Minor
@spectrum-web-components/color-wheel Minor
@spectrum-web-components/combobox Minor
@spectrum-web-components/contextual-help Minor
@spectrum-web-components/dialog Minor
@spectrum-web-components/divider Minor
@spectrum-web-components/dropzone Minor
@spectrum-web-components/field-group Minor
@spectrum-web-components/field-label Minor
@spectrum-web-components/help-text Minor
@spectrum-web-components/icon Minor
@spectrum-web-components/icons-ui Minor
@spectrum-web-components/icons-workflow Minor
@spectrum-web-components/icons Minor
@spectrum-web-components/iconset Minor
@spectrum-web-components/illustrated-message Minor
@spectrum-web-components/infield-button Minor
@spectrum-web-components/link Minor
@spectrum-web-components/menu Minor
@spectrum-web-components/meter Minor
@spectrum-web-components/modal Minor
@spectrum-web-components/number-field Minor
@spectrum-web-components/overlay Minor
@spectrum-web-components/picker-button Minor
@spectrum-web-components/picker Minor
@spectrum-web-components/popover Minor
@spectrum-web-components/progress-bar Minor
@spectrum-web-components/progress-circle Minor
@spectrum-web-components/radio Minor
@spectrum-web-components/search Minor
@spectrum-web-components/sidenav Minor
@spectrum-web-components/slider Minor
@spectrum-web-components/split-view Minor
@spectrum-web-components/status-light Minor
@spectrum-web-components/swatch Minor
@spectrum-web-components/switch Minor
@spectrum-web-components/table Minor
@spectrum-web-components/tabs Minor
@spectrum-web-components/tags Minor
@spectrum-web-components/textfield Minor
@spectrum-web-components/thumbnail Minor
@spectrum-web-components/toast Minor
@spectrum-web-components/tooltip Minor
@spectrum-web-components/top-nav Minor
@spectrum-web-components/tray Minor
@spectrum-web-components/underlay Minor
@spectrum-web-components/custom-vars-viewer Minor
@spectrum-web-components/story-decorator Minor
@spectrum-web-components/vrt-compare Minor
@spectrum-web-components/bundle Minor
@spectrum-web-components/grid Minor
@spectrum-web-components/opacity-checkerboard Minor
@spectrum-web-components/shared Minor
@spectrum-web-components/styles Minor
@spectrum-web-components/theme Minor
@spectrum-web-components/truncated Minor
@spectrum-web-components/reactive-controllers Minor
@adobe/spectrum-wc Minor
documentation Patch
@spectrum-web-components/eslint-plugin Minor
@spectrum-web-components/stylelint-header-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread 1st-gen/tools/base/src/sizedMixin.ts
Comment thread 2nd-gen/packages/core/components/badge/Badge.types.ts
Comment thread 2nd-gen/packages/core/mixins/sized-mixin.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When 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: pr-6067

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Comment thread 2nd-gen/packages/swc/.storybook/preview.ts
@caseyisonit caseyisonit added the Status:Ready for review PR ready for review or re-review. label Mar 6, 2026
@caseyisonit caseyisonit added Status:WIP PR is a work in progress or draft Status:Ready for review PR ready for review or re-review. and removed Status:Ready for review PR ready for review or re-review. Status:WIP PR is a work in progress or draft labels Mar 9, 2026
@caseyisonit caseyisonit added High priority PR review PR is a high priority and should be reviewed ASAP Status:Ready for re-review PR has had its feedback addressed and is once again ready for review. labels Mar 23, 2026
@caseyisonit
Copy link
Copy Markdown
Contributor Author

@rubencarvalho @nikkimk @rise-erpelding @marissahuysentruyt @Rajdeepc I have replied and addressed all feedback/questions but let me know if you want to chat more!

@marissahuysentruyt for the table overflow issue we can come back to that in the storybook CSS clean up or the docs IA work, does that sound cool?

@rubencarvalho for the questions about the other areas of standardization, lets capture that for a future sync OR in a ticket for milestone 3 for this to be additive. i would like to get this first pass in and then continue making improvements if that sounds cool to you too.

@Rajdeepc The split out PRs did not include the feedback applied and i was already well through addressing feedback before my PTO so this is the easiest path forward for me. We can discuss this in retro about size, scope, and picking up someone else's branch/expectations if you do so. I understand you were trying to help by making the PR smaller to review but i would like to move forward with how the PR is staged currently and we learn from it moving forward.

}

/**
* @todo Migrate from update() to updated() for consistency with other
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: What's the team's approach to tracking @todos ? How do you track when these items should be completed or if they have been?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great question!! we do not currently have a formal process to track them short of searching @todo or addressing it when working in a file. this is something we still need to define and work out a process for moving forward!

Copy link
Copy Markdown
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I've seen that YARN_LOG.txt file before! Was that an intentional addition to this PR? What do you use it for?

Claude found a few conflicts and left a few suggestions. 👍

Comment thread 2nd-gen/packages/swc/components/asset/Asset.ts
Comment thread CONTRIBUTOR-DOCS/02_style-guide/02_typescript/04_lit-decorators.md
Comment thread CONTRIBUTOR-DOCS/02_style-guide/02_typescript/05_property-patterns.md Outdated
Comment thread CONTRIBUTOR-DOCS/02_style-guide/02_typescript/11_base-vs-concrete.md Outdated
Comment thread .changeset/friendly-tables-travel.md
Comment thread CONTRIBUTOR-DOCS/02_style-guide/02_typescript/02_class-structure.md Outdated
Comment thread .changeset/friendly-tables-travel.md
@caseyisonit caseyisonit enabled auto-merge (squash) March 27, 2026 22:53
@caseyisonit caseyisonit merged commit ba14a2b into main Mar 30, 2026
27 of 28 checks passed
@caseyisonit caseyisonit deleted the caseyisonit/typescript-guide branch March 30, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. High priority PR review PR is a high priority and should be reviewed ASAP Status:Ready for re-review PR has had its feedback addressed and is once again ready for review. Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants