Skip to content

feat: add @deprecated JSDoc comments to component library replacements#26696

Merged
georgewrmarshall merged 4 commits into
mainfrom
dsys-494-add-deprecated-jsdoc-comments
Feb 27, 2026
Merged

feat: add @deprecated JSDoc comments to component library replacements#26696
georgewrmarshall merged 4 commits into
mainfrom
dsys-494-add-deprecated-jsdoc-comments

Conversation

@georgewrmarshall

@georgewrmarshall georgewrmarshall commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds @deprecated JSDoc comments with README links to 20 component library files that have replacements in the MetaMask Design System (MMDS).

The deprecation messages provide clear migration paths for developers by:

  1. Indicating which MMDS component to use as a replacement
  2. Warning that the API may have changed
  3. Linking directly to the component's README in the MMDS repository

This work improves developer experience by making it easier to migrate from legacy component library components to the standardized MMDS components.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-494

Manual testing steps

Feature: JSDoc deprecation comments

  Scenario: developer views deprecated component
    Given a developer opens a component library file
    
    When developer hovers over a deprecated component import
    Then the IDE should display the @deprecated JSDoc comment with migration guidance
    And the comment should include a link to the MMDS component README

Screenshots/Recordings

N/A - Documentation-only changes

Before

Components had either no deprecation messages or minimal ones without full context.

After

All 20 components now have consistent deprecation messages following this pattern:

/**
 * @deprecated Please update your code to use `ComponentName` from `@metamask/design-system-react-native`.
 * The API may have changed — compare props before migrating.
 * @see {@link https://github.com/MetaMask/metamask-design-system/blob/main/packages/design-system-react-native/src/components/ComponentName/README.md}
 */

Components updated:

  • Avatar components: AvatarAccount, AvatarBase, AvatarFavicon, AvatarGroup, AvatarIcon, AvatarNetwork, AvatarToken
  • Badge components: BadgeBase, BadgeNetwork, BadgeNotifications, BadgeWrapper
  • Button components: Button, ButtonIcon, ButtonLink, ButtonPrimary, ButtonSecondary
  • Form components: Checkbox, TextField
  • Other components: Card, Icon, Text

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk documentation-only change: adds/standardizes @deprecated JSDoc blocks and external README links without altering component runtime behavior. Main risk is minor lint/formatting or tooling differences in how IDEs surface these comments.

Overview
Adds consistent @deprecated JSDoc annotations across legacy component-library UI components (avatars, badges, buttons, checkbox, text field, icon, text), pointing developers to the equivalent @metamask/design-system-react-native replacements.

Each deprecation notice now includes a migration caution about potential API differences and a direct link to the relevant MMDS README for the replacement component.

Written by Cursor Bugbot for commit 167e357. This will update automatically on new commits. Configure here.

Added deprecation messages with README links to 20 component library files
that have replacements in the MetaMask Design System (MMDS).

Components updated:
- Avatar components (AvatarAccount, AvatarBase, AvatarFavicon, AvatarGroup, AvatarIcon, AvatarNetwork, AvatarToken)
- Badge components (BadgeBase, BadgeNetwork, BadgeNotifications, BadgeWrapper)
- Button components (Button, ButtonIcon, ButtonLink, ButtonPrimary, ButtonSecondary)
- Form components (Checkbox, TextField)
- Other components (Card, Icon, Text)

All deprecation messages follow the pattern:
- @deprecated tag with clear migration guidance
- Note that API may have changed
- @see tag linking to MMDS component README

This provides developers with clear migration paths and documentation links.
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-design-system All issues relating to design system in Mobile label Feb 27, 2026
Comment on lines +1 to +6
/**
* @deprecated Please update your code to use `BadgeIcon` from `@metamask/design-system-react-native`.
* The API may have changed — compare props before migrating.
* @see {@link https://github.com/MetaMask/metamask-design-system/blob/main/packages/design-system-react-native/src/components/BadgeIcon/README.md}
*/

@georgewrmarshall georgewrmarshall Feb 27, 2026

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.

Just double checking BadgeIcon is the correct replacement for BadgeNotification here @brianacnguyen? Storybook below

Image

Takes an iconName 🤔

const BadgeNotifications = ({
  style,
  iconName,
  testID,
}: BadgeNotificationsProps) => {
  const { size: containerSize, onLayout: onLayoutContainerSize } =
    useComponentSize();
  const { styles } = useStyles(styleSheet, { style, containerSize });
  return (
    <BadgeBase
      style={styles.base}
      testID={testID}
      onLayout={onLayoutContainerSize}
    >
      <Icon name={iconName} size={IconSize.Xss} color={IconColor.Inverse} />
    </BadgeBase>
  );
};

Moved deprecation JSDoc comments from file tops to immediately above their
respective component definitions for better IDE integration and clarity.

This placement allows developers to see deprecation warnings when they
hover over or use the component, rather than only at file import time.
@georgewrmarshall

Copy link
Copy Markdown
Contributor Author

Updated all @deprecated comments to be placed just above their component definitions rather than at the top of the file. This ensures better IDE integration - developers will see the deprecation warning when they hover over or use the component, not just when importing the file.

…tions

Moved all deprecation JSDoc comments to be placed immediately above their
component definitions for consistent IDE integration across all 20 components.

Components updated:
- Text, Icon, Checkbox
- Button, ButtonIcon, ButtonPrimary, ButtonSecondary, ButtonLink
- AvatarBase, AvatarIcon, AvatarNetwork, AvatarToken
- BadgeBase, BadgeWrapper

This ensures developers see deprecation warnings when using components,
not just when importing files.
@georgewrmarshall georgewrmarshall self-assigned this Feb 27, 2026
@github-actions github-actions Bot added size-M and removed size-S labels Feb 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 98%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 20 changed files contain only documentation changes - specifically JSDoc comment modifications. The changes involve:

  1. Moving @deprecated JSDoc comments from the top of the file to directly above the component function definition
  2. Enhancing deprecation messages with additional guidance ("The API may have changed — compare props before migrating")
  3. Adding @see links to the design system documentation

No functional code changes were made to any component. The component implementations, props, styles, and behavior remain completely unchanged. These are purely cosmetic/documentation improvements that:

  • Don't affect runtime behavior
  • Don't change any component APIs
  • Don't modify any rendering logic
  • Only improve developer experience through better IDE deprecation warnings

Since there are no functional changes, no E2E tests are needed to validate this PR. The changes cannot break any user flows or features.

Performance Test Selection:
These changes are purely documentation/JSDoc comment modifications with no functional code changes. The component implementations remain unchanged, so there is no impact on rendering performance, data loading, or any other performance-sensitive operations. No performance tests are needed.

View GitHub Actions results

@georgewrmarshall georgewrmarshall marked this pull request as ready for review February 27, 2026 20:35
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner February 27, 2026 20:35
* The API may have changed — compare props before migrating.
* @see {@link https://github.com/MetaMask/metamask-design-system/blob/main/packages/design-system-react-native/src/components/AvatarBase/README.md}
*/
const AvatarBase: React.FC<AvatarBaseProps> = ({

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.

The @deprecated tag is placed directly above the component const declaration rather than at the top of the file. This is intentional: TypeScript and IDE tooling only surface JSDoc annotations for the symbol they immediately precede, so file-level placement would have silently no-op'd on hover/autocomplete.


/**
* @deprecated Please update your code to use `AvatarBase` from `@metamask/design-system-react-native`.
* The API may have changed — compare props before migrating.

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.

The 'The API may have changed — compare props before migrating.' line is added to every component rather than just some. This is a blanket safety note since the design-system-react-native package evolved independently; consumers should not assume a direct prop-for-prop swap without checking the linked README.

/**
* @deprecated Please update your code to use `BadgeCount`, `BadgeIcon`, `BadgeNetwork` or `BadgeStatus` from `@metamask/design-system-react-native`.
* The API may have changed — compare props before migrating.
* @see {@link https://github.com/MetaMask/metamask-design-system/tree/main/packages/design-system-react-native/src/components}

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.

BadgeBase maps to four distinct components in the new package (BadgeCount, BadgeIcon, BadgeNetwork, BadgeStatus) rather than a single replacement, so the @see link points to the components directory instead of a specific README. Consumers need to identify the right replacement based on the badge type they are rendering.

} from './ButtonLink.constants';

/**
* @deprecated Please update your code to use `TextButton` from `@metamask/design-system-react-native`.

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.

ButtonLink is renamed to TextButton in the design-system-react-native package, not just moved. Consumers migrating this component will need to update both the import path and the component name.

import { DEFAULT_BUTTONPRIMARY_LABEL_TEXTVARIANT } from './ButtonPrimary.constants';

/**
* @deprecated Please update your code to use `Button` from `@metamask/design-system-react-native` with variant `ButtonVariant.Primary`.

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.

ButtonPrimary and ButtonSecondary are consolidated into a single Button component in the new package, selected via ButtonVariant.Primary and ButtonVariant.Secondary. This reflects a design-system API change where separate variant components are replaced with a single component plus a variant prop.

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit 10ab00e Feb 27, 2026
63 checks passed
@georgewrmarshall georgewrmarshall deleted the dsys-494-add-deprecated-jsdoc-comments branch February 27, 2026 21:53
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-M team-design-system All issues relating to design system in Mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants