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 codemod for components to slots renaming #7533

Merged
merged 11 commits into from
Jan 20, 2023

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Jan 13, 2023

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 change

TypeScript 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

@mui-bot
Copy link

mui-bot commented Jan 13, 2023

Messages
📖 Netlify deploy preview: https://deploy-preview-7533--material-ui-x.netlify.app/

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 735.3 1,312.9 1,312.9 1,019.12 198.209
Sort 100k rows ms 633.1 1,292.3 1,252.1 1,091.64 246.053
Select 100k rows ms 179.2 315.1 235.5 249.46 46.41
Deselect 100k rows ms 203.4 370.7 231.8 276.34 72.608

Generated by 🚫 dangerJS against 7f1a334

@zannager zannager added the package: codemod Specific to @mui/codemod label Jan 13, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 16, 2023
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Jan 16, 2023
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 17, 2023

.forEach((path) => {
path.node.specifiers.forEach((node) => {
// Process only Joy UI components
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
// Process only Joy UI components
// Process only date-pickers components

@flaviendelangle
Copy link
Member

Not sure if it should be added to preset-safe because it's not stickily speaking a breaking change

I think it should be included to the v7 preset safe since it will be a breaking change then.
But for now I would keep it as a standalone.

@alexfauquette alexfauquette merged commit 88906d1 into mui:next Jan 20, 2023
@alexfauquette alexfauquette deleted the fix-codemod branch January 20, 2023 09:53
@LukasTy LukasTy added v6.x and removed v6.x labels Jan 25, 2023
root
.find(j.ImportDeclaration)
.filter(({ node }) => {
return node.source.value.startsWith('@mui/x-date-picker');
Copy link
Member

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. 🤔

Copy link
Member Author

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

Copy link
Member

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? 🤔

Copy link
Member

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

Copy link
Member Author

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)

@LukasTy LukasTy changed the title [codemod] Add codemod for components to slots remaining [codemod] Add codemod for components to slots renaming Jan 27, 2023
@LukasTy LukasTy added the component: pickers This is the name of the generic UI component, not the React module! label Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers 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.

6 participants