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

[codemod] Add v5.0.0/date-pickers-moved-to-x codemod #31373

Merged
merged 5 commits into from
Mar 31, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Mar 8, 2022

Part of mui/mui-x#3451

It is my 1st time playing with codemod so feel free to say if I did something wrong.

  • Import from @mui/x-date-pickers if all the imports are available in it, import from @mui/x-date-pickers-pro otherwise
  • Replace default import of sub-module by named import (import DatePicker from '@mui/lab/DatePicker' becomes import { DatePicker } from '@mui/x-date-pickers/DatePicker')

@flaviendelangle flaviendelangle added component: date picker This is the name of the generic UI component, not the React module! package: codemod Specific to @mui/codemod labels Mar 8, 2022
@flaviendelangle flaviendelangle self-assigned this Mar 8, 2022
@mui-bot
Copy link

mui-bot commented Mar 8, 2022

No bundle size changes

Generated by 🚫 dangerJS against 68824d9

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Looks good, please add it in the readme of the codemod package before merging.

@flaviendelangle
Copy link
Member Author

Thank's for your feedbacks
I will wait for the merge of the X pickers to avoid confusion for users.

@flaviendelangle
Copy link
Member Author

@mnajdova done for the README

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Well done

@flaviendelangle flaviendelangle merged commit 4073db6 into mui:master Mar 31, 2022
@flaviendelangle flaviendelangle deleted the codemode-date-pickers branch March 31, 2022 08:36
Rename the imports of date and time pickers from `@mui/lab` to `@mui/x-date-pickers` and `@mui/x-date-pickers-pro`.

```sh
npx @mui/codemod v5.0.0/date-pickers-moved-to-x <path>
Copy link
Member

@oliviertassinari oliviertassinari May 12, 2022

Choose a reason for hiding this comment

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

This codemod impacts v5 but not v5.0.0. Maybe it would have made more sense with

Suggested change
npx @mui/codemod v5.0.0/date-pickers-moved-to-x <path>
npx @mui/codemod v5.6.0/date-pickers-moved-to-x <path>

or

Suggested change
npx @mui/codemod v5.0.0/date-pickers-moved-to-x <path>
npx @mui/codemod v5/date-pickers-moved-to-x <path>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module! package: codemod Specific to @mui/codemod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants