Skip to content

chore(2nd-gen): review and apply code standards across all components#6091

Merged
caseyisonit merged 3 commits intomainfrom
rajdeepc/chore-2nd-gen-code-standards
Mar 27, 2026
Merged

chore(2nd-gen): review and apply code standards across all components#6091
caseyisonit merged 3 commits intomainfrom
rajdeepc/chore-2nd-gen-code-standards

Conversation

@Rajdeepc
Copy link
Copy Markdown
Contributor

@Rajdeepc Rajdeepc commented Mar 19, 2026

Summary

Audited and standardized code patterns across all 2nd-gen base classes and SWC components, using Badge as the canonical reference implementation. This brings consistency to section headers, JSDoc tags, type patterns, CSS class naming, and other conventions.

Changes by category

Structural consistency

  • Added API TO OVERRIDE / SHARED API / IMPLEMENTATION section headers to DividerBase and AlertBannerBase
  • Standardized Divider's styles declaration from static property to getter (matching Badge, StatusLight, ProgressCircle, Asset)

CSS class naming

  • Renamed Asset CSS classes from spectrum-* to swc-* prefix (matching all other 2nd-gen components)

JSDoc standardization

  • Added @slot, @attribute, and @fires tags to DividerBase and AlertBannerBase
  • Removed incorrect @element tag from DividerBase (belongs only on SWC subclass)
  • Replaced @param JSDoc tags with standard property docs in AlertBannerBase
  • Fixed extra space before @example in StatusLight

Type patterns

  • Removed redundant : ElementSize[] type annotations from STATUSLIGHT_VALID_SIZES and PROGRESS_CIRCLE_VALID_SIZES (keep as const satisfies only)
  • Added as const satisfies readonly string[] to DIVIDER_STATIC_COLORS and ASSET_VARIANTS
  • Extracted AlertBanner.types.ts from inline module-level constants, with deprecated AlertBannerVariants alias for 1st-gen compatibility

Mixin usage

  • Passed STATUSLIGHT_VALID_SIZES explicitly to SizedMixin in StatusLightBase (matching Badge and Divider patterns)

Cleanup

  • Fixed typo: "exisit" → "exist" in observe-slot-text.ts
  • Updated copyright year from 2025 to 2026 in postcss-token/index.d.ts and screen-reader-addon/register.tsx

Files changed (16)

File Change
core/components/alert-banner/AlertBanner.base.ts Section headers, JSDoc, types import
core/components/alert-banner/AlertBanner.types.ts New — extracted types and constants
core/components/alert-banner/index.ts Re-export types
core/components/asset/Asset.types.ts as const satisfies
core/components/divider/Divider.base.ts Section headers, JSDoc, remove @element
core/components/divider/Divider.types.ts as const satisfies
core/components/progress-circle/ProgressCircle.types.ts Remove redundant type annotation
core/components/status-light/StatusLight.base.ts Explicit validSizes in SizedMixin, @attribute tag
core/components/status-light/StatusLight.types.ts Remove redundant type annotation
core/mixins/observe-slot-text.ts Fix typo
swc/components/asset/Asset.ts spectrum-*swc-* class prefix
swc/components/asset/asset.css spectrum-*swc-* selectors
swc/components/divider/Divider.ts styles property → getter
swc/components/status-light/StatusLight.ts Fix @example spacing
tools/postcss-token/index.d.ts Copyright 2025 → 2026
.storybook/addons/screen-reader-addon/src/register.tsx Copyright 2025 → 2026

Test plan

  • 2nd-gen build passes (yarn build:2nd-gen)
  • 1st-gen build passes (yarn build:1st-gen) — backward-compatible AlertBanner type alias verified
  • All linters pass (ESLint, Stylelint, Prettier via pre-commit hooks)
  • CI tests pass
  • VRT confirms no visual regressions (Asset CSS rename)

Audit and standardize patterns across all 2nd-gen base classes and SWC
components, using Badge as the canonical reference implementation.

- Add section headers to DividerBase and AlertBannerBase
- Fix Asset CSS class prefix from spectrum- to swc-
- Standardize Divider styles declaration to use getter
- Add JSDoc tags (@slot, @Attribute, @fires) to base classes
- Remove incorrect @element from DividerBase
- Standardize as const satisfies in all types files
- Pass STATUSLIGHT_VALID_SIZES explicitly to SizedMixin
- Extract AlertBanner.types.ts from inline module constants
- Fix @param JSDoc to standard property docs in AlertBanner
- Fix typo ("exisit" -> "exist") in observe-slot-text.ts
- Update copyright years from 2025 to 2026
- Fix extra space in StatusLight JSDoc @example tag

Made-with: Cursor
@Rajdeepc Rajdeepc requested a review from a team as a code owner March 19, 2026 06:20
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 19, 2026

⚠️ No Changeset found

Latest commit: d47aaea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 19, 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-6091

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.

@Rajdeepc Rajdeepc self-assigned this Mar 19, 2026
@Rajdeepc Rajdeepc added the 2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. label Mar 19, 2026
…ions

Replace nested ternary with Lit's choose directive for variant-based
rendering, aligning with conventions established in PR #6067.

Made-with: Cursor
@caseyisonit caseyisonit added Status:Ready for review PR ready for review or re-review. High priority PR review PR is a high priority and should be reviewed ASAP labels Mar 23, 2026
@caseyisonit caseyisonit self-assigned this Mar 23, 2026
@caseyisonit caseyisonit removed the High priority PR review PR is a high priority and should be reviewed ASAP label Mar 23, 2026
@caseyisonit caseyisonit enabled auto-merge (squash) March 27, 2026 23:47
@caseyisonit caseyisonit merged commit 372ab98 into main Mar 27, 2026
27 of 30 checks passed
@caseyisonit caseyisonit deleted the rajdeepc/chore-2nd-gen-code-standards branch March 27, 2026 23:53
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. Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants