-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 codemod for components
to slots
renaming
#7533
Conversation
These are the results for the performance tests:
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
||
.forEach((path) => { | ||
path.node.specifiers.forEach((node) => { | ||
// Process only Joy UI components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Process only Joy UI components | |
// Process only date-pickers components |
I think it should be included to the v7 preset safe since it will be a breaking change then. |
packages/x-codemod/src/v6.0.0/pickers/rename-components-to-slots/actual-props.spec.js
Show resolved
Hide resolved
root | ||
.find(j.ImportDeclaration) | ||
.filter(({ node }) => { | ||
return node.source.value.startsWith('@mui/x-date-picker'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Maybe this codemod could not be pickers
specific but handle both data grid as well as pickers changes?
I believe that both packages did make the change of deprecating the old components
naming and adding slots
. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would not make sense with the comande line name
npx @mui/x-codemod v6.0.0/pickers/migrate-to-components-componentsProps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, that's why I was thinking if it wouldn't make sense to just move this codemod to top level? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or may be create a util and reuse in both data grid and pickers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would allow users to do the migration in two steps: the data grid then the pickers (or the opposit)
components
to slots
remainingcomponents
to slots
renaming
Part of #6997 and need #7528 to be merged first (noticed the typo when writing this PR)
I applied the codemod to the docs demonstrations
Not sure if it should be added to
preset-safe
because it's not stickily speaking a breaking changeTypeScript is failing, because the docs still contain some legacy components that do not support
slots
/slotProps
.We should warn about using it only after the migration of components to v6