react-codemod icon indicating copy to clipboard operation
react-codemod copied to clipboard

feat: add React 19 replace default props transform

Open amirabbas-gh opened this issue 9 months ago • 4 comments

📚 Description

This PR is created to update the react-codemod repository with the updates for the react/19/replace-default-props codemod and to align the open-source content of this codemod in react-codemod similar to the Codemod repository.

  1. Added Codemod Utils Package

    • Added @codemod.com/codemod-utils package as a dependency to facilitate codemod development.
  2. Added Custom TypeScript Configuration for Codemods

"Introduced tsconfig.codemod.json to provide a dedicated TypeScript configuration for transforms from the Codemod repository.
A dedicated tsconfig.codemod.json has been added to support the new transform from the Codemod repository and ensure it has the required TypeScript configuration.

  1. New Transform: React 19 Replace Default Props
    • Added a new transform react-19-replace-default-props to handle default props migration for React 19.
    • Comprehensive tests were included to ensure reliability and coverage.
    • Available will using npx codemod react/19/replace-default-props

🧪 Test Plan

The following steps were taken to ensure the changes function as intended:

  1. Ran the test suite to validate existing functionality and new transforms.
  2. Verified type resolution and TypeScript transform compatibility.
  3. To confirm accuracy, the react-19-replace-default-props transform was executed against test cases.

amirabbas-gh avatar Jan 31 '25 20:01 amirabbas-gh