-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
[base] Codemod for hook directory migration #36295
Conversation
Netlify deploy previewhttps://deploy-preview-36295--material-ui.netlify.app/ Bundle size report |
Should we wait for this to be merged before releasing? Having this in a release after people already migrated may not be as useful as having it in the same release. Can you please include a Breaking change description in #36235 so that people know how the migration should look like? |
I've found one case where it doesn't produce a valid output (but it should be pretty uncommon): import { useSwitch as useBaseSwitch } from '@mui/base/SwitchUnstyled'; should transform to import useBaseSwitch from '@mui/base/useSwitch'; but instead produces import useSwitch from '@mui/base/useSwitch' |
@michaldudak Thanks! I addressed your comment. |
@michaldudak Thanks! I addressed your comment here and added the test here. |
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.
I tried some other scenarios and couldn't spot any more issues.
return sourceVal.startsWith('@mui/base/') && sourceVal.match('Unstyled'); | ||
}) // Process only Base components | ||
.forEach((path) => { | ||
// scenario 1: `@mui/base/<Component>Unstyled/use<Component>` |
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.
I don't think that this import was even supported at all. But let's keep it just in case 🤷
packages/mui-codemod/src/v5.0.0/base-hook-imports.test/actual.js
Outdated
Show resolved
Hide resolved
packages/mui-codemod/src/v5.0.0/base-hook-imports.test/actual.js
Outdated
Show resolved
Hide resolved
@mnajdova Addressed your comments! |
Follow-up on #36235 (review)