Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Add codemods for v6 breaking changes #7086

Closed
16 tasks done
MBilalShafi opened this issue Dec 4, 2022 · 0 comments
Closed
16 tasks done

[DataGrid] Add codemods for v6 breaking changes #7086

MBilalShafi opened this issue Dec 4, 2022 · 0 comments
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! package: codemod Specific to @mui/codemod umbrella For grouping multiple issues to provide a holistic view v6.x

Comments

@MBilalShafi
Copy link
Member

MBilalShafi commented Dec 4, 2022

Codemods for pickers can be found here

The v6 for DataGrid is bringing quite a few breaking changes.
To ease users' migration we ought to try and cover as most changes with codemods as possible.

The codemod package can be found here. It contains all the core setup needed in order to add new codemods to it.

This is intended as an umbrella issue to group all the codemods needed for v.6.x migration for DataGrid.
Ideally as much migrations as possible should be provided with preset-safe codemod.

The process of adding a new codemod

  • One of the existing codemods can be used as an example (i.e.: localization-provider-rename-locale)
  • copy or create a new folder for your codemod
  • all the relevant code that is eventually shipped to the user is in index.ts
  • update/provide tests for your newly created codemod (test fixtures are authored as js files to allow as minimal syntax as you want—without triggering ts issues)
  • if your codemod is safe to add to preset-safe—update this codemod with your newly added codemod making sure the codemods order is correct if codemod is sensitive to that (i.e. separate props should firstly be migrated to componentProps and only later be passed through a codemod renaming componentProps to slotProps if we'd go with such approach)
  • update README file with your newly added codemod
    You can check @mui/codemod for inspiration on more advanced migration cases.

How to test your changes locally (on a different project)

P.S. yarn link does not create a bin command from a linked package

  • run build with either yarn workspace @mui/x-codemod build or yarn build if you are in src/packages/x-codemod
  • run cd build && yarn pack
  • copy the built 7.tgz file to the root of your project you want to run (test) the codemod in
  • add "@mui/x-codemod": "file:./<your_package_name>" into your project dependencies
  • run yarn install
  • now you can run the codemod in the way you prefer (either through npx @mui/x-codemod v6.0.0/preset-safe src or by adding an x-codemod script in your project)
  • caveat: testing iterative changes might result in a cached package version being used instead of your latest modification. You can either use a unique package name (possibly quicker) each time or clean npm cache each time.

Breaking changes requiring codemods

Breaking changes related to DataGrid are documented here and relevant PRs are available with applied filters.

@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! umbrella For grouping multiple issues to provide a holistic view v6.x package: codemod Specific to @mui/codemod labels Dec 4, 2022
@MBilalShafi MBilalShafi self-assigned this Dec 4, 2022
@MBilalShafi MBilalShafi changed the title [DataGrid] Add codemods for breaking changes [DataGrid] Add codemods for v6 breaking changes Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! package: codemod Specific to @mui/codemod umbrella For grouping multiple issues to provide a holistic view v6.x
Projects
None yet
Development

No branches or pull requests

1 participant