Codemod scripts for MUI
This repository contains a collection of codemod scripts based for use with jscodeshift that help update MUI APIs.
npx @mui/codemod <codemod> <paths...>
Applies a `@mui/codemod` to the specified paths
Positionals:
codemod The name of the codemod [string]
paths Paths forwarded to `jscodeshift` [string]
Options:
--version Show version number [boolean]
--help Show help [boolean]
--dry dry run (no changes are made to files)
[boolean] [default: false]
--print print transformed files to stdout, useful for development
[boolean] [default: false]
--jscodeshift [string] [default: false]
Examples:
npx @mui/codemod v4.0.0/theme-spacing-api src
npx @mui/codemod v5.0.0/component-rename-prop src --
--component=Grid --from=prop --to=newProp
To pass more options directly to jscodeshift, use --jscodeshift="..."
. For example:
npx @mui/codemod --jscodeshift="--run-in-band --verbose=2"
See all available options here.
Options to recast's printer can be provided
through jscodeshift's printOptions
command line argument
npx @mui/codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"double\"}'"
A combination of all important transformers for migrating v4 to v5.
npx @mui/codemod v5.0.0/preset-safe <path|folder>
The list includes these transformers
adapter-v4
autocomplete-rename-closeicon
autocomplete-rename-option
avatar-circle-circular
badge-overlap-value
box-borderradius-values
box-rename-css
box-rename-gap
button-color-prop
chip-variant-prop
circularprogress-variant
collapse-rename-collapsedheight
core-styles-import
create-theme
dialog-props
dialog-title-props
emotion-prepend-cache
expansion-panel-component
fab-variant
fade-rename-alpha
grid-justify-justifycontent
grid-list-component
icon-button-size
material-ui-styles
material-ui-types
modal-props
moved-lab-modules
pagination-round-circular
optimal-imports
root-ref
skeleton-variant
styled-engine-provider
table-props
tabs-scroll-buttons
textarea-minmax-rows
theme-augment
theme-breakpoints
theme-breakpoints-width
theme-options
theme-palette-mode
theme-provider
theme-spacing
theme-typography-round
transitions
use-autocomplete
use-transitionprops
with-mobile-dialog
with-width
mui-replace
Imports and inserts adaptV4Theme
into createTheme
(or createMuiTheme
)
+import { adaptV4Theme } from '@material-ui/core/styles';
-createTheme({ palette: { ... }})
+createTheme(adaptV4Theme({ palette: { ... }}))
npx @mui/codemod v5.0.0/adapter-v4 <path>
You can find more details about this breaking change in the migration guide.
Renames Autocomplete
's closeIcon
prop to clearIcon
.
-<Autocomplete closeIcon={defaultClearIcon} />
+<Autocomplete clearIcon={defaultClearIcon} />
npx @mui/codemod v5.0.0/autocomplete-rename-closeicon <path>
You can find more details about this breaking change in the migration guide.
Renames Autocomplete
's getOptionSelected
to isOptionEqualToValue
.
<Autocomplete
- getOptionSelected={(option, value) => option.title === value.title}
+ isOptionEqualToValue={(option, value) => option.title === value.title}
/>
npx @mui/codemod v5.0.0/autocomplete-rename-option <path>
You can find more details about this breaking change in the migration guide.
Updates the Avatar
's variant
value and classes
key from 'circle' to 'circular'.
-<Avatar variant="circle" />
-<Avatar classes={{ circle: 'className' }} />
+<Avatar variant="circular" />
+<Avatar classes={{ circular: 'className' }} />
npx @mui/codemod v5.0.0/avatar-circle-circular <path>
You can find more details about this breaking change in the migration guide.
Renames the badge's props.
-<Badge overlap="circle">
-<Badge overlap="rectangle">
+<Badge overlap="circular">
+<Badge overlap="rectangular">
<Badge classes={{
- anchorOriginTopRightRectangle: 'className',
- anchorOriginBottomRightRectangle: 'className',
- anchorOriginTopLeftRectangle: 'className',
- anchorOriginBottomLeftRectangle: 'className',
- anchorOriginTopRightCircle: 'className',
- anchorOriginBottomRightCircle: 'className',
- anchorOriginTopLeftCircle: 'className',
+ anchorOriginTopRightRectangular: 'className',
+ anchorOriginBottomRightRectangular: 'className',
+ anchorOriginTopLeftRectangular: 'className',
+ anchorOriginBottomLeftRectangular: 'className',
+ anchorOriginTopRightCircular: 'className',
+ anchorOriginBottomRightCircular: 'className',
+ anchorOriginTopLeftCircular: 'className',
}}>
npx @mui/codemod v5.0.0/badge-overlap-value <path>
You can find more details about this breaking change in the migration guide.
Updates the Box API from separate system props to sx
.
-<Box borderRadius="borderRadius">
-<Box borderRadius={16}>
+<Box borderRadius={1}>
+<Box borderRadius="16px">
npx @mui/codemod v5.0.0/box-borderradius-values <path>
You can find more details about this breaking change in the migration guide.
Renames the Box css
prop to sx
-<Box css={{ m: 2 }}>
+<Box sx={{ m: 2 }}>
npx @mui/codemod v5.0.0/box-rename-css <path>
You can find more details about this breaking change in the migration guide.
Renames the Box grid*Gap
props.
-<Box gridGap={2}>Item 3</Box>
-<Box gridColumnGap={3}>Item 4</Box>
-<Box gridRowGap={4}>Item 5</Box>
+<Box gap={2}>Item 3</Box>
+<Box columnGap={3}>Item 4</Box>
+<Box rowGap={4}>Item 5</Box>
npx @mui/codemod v5.0.0/box-rename-gap <path>
You can find more details about this breaking change in the migration guide.
Removes the outdated color
prop values.
-<Button color="default">
+<Button>
npx @mui/codemod v5.0.0/button-color-prop <path>
You can find more details about this breaking change in the migration guide.
Removes the Chip variant
prop if the value is "default"
.
-<Chip variant="default">
+<Chip>
npx @mui/codemod v5.0.0/chip-variant-prop <path>
You can find more details about this breaking change in the migration guide.
Renames the CircularProgress static
variant to determinate
.
-<CircularProgress variant="static" classes={{ static: 'className' }} />
+<CircularProgress variant="determinate" classes={{ determinate: 'className' }} />
npx @mui/codemod v5.0.0/circularprogress-variant <path>
You can find more details about this breaking change in the migration guide.
Renames Collapse
's collapsedHeight
prop to collapsedSize
.
-<Collapse collapsedHeight={40} />
-<Collapse classes={{ container: 'collapse' }} />
+<Collapse collapsedSize={40} />
+<Collapse classes={{ root: 'collapse' }} />
npx @mui/codemod v5.0.0/collapse-rename-collapsedheight <path>
You can find more details about this breaking change in the migration guide.
A generic codemod to rename any component prop.
-<Component prop="value" />
-<Component prop />
+<Component newProp="value" />
+<Component newProp />
npx @mui/codemod v5.0.0/component-rename-prop <path> -- --component=Grid --from=prop --to=newProp
Renames private import from core/styles/*
to core/styles
-import { darken, lighten } from '@material-ui/core/styles/colorManipulator';
+import { darken, lighten } from '@material-ui/core/styles';
npx @mui/codemod v5.0.0/core-styles-import <path>
Renames the function createMuiTheme
to createTheme
-import { createMuiTheme } from '@material-ui/core/styles';
+import { createTheme } from '@material-ui/core/styles';
npx @mui/codemod v5.0.0/create-theme <path>
Remove disableBackdropClick
prop from <Dialog>
-<Dialog disableBackdropClick />
+<Dialog />
npx @mui/codemod v5.0.0/dialog-props <path>
You can find more details about this breaking change in the migration guide.
Remove disableTypography
prop from <DialogTitle>
-<DialogTitle disableTypography />
+<DialogTitle />
npx @mui/codemod v5.0.0/dialog-title-props <path>
You can find more details about this breaking change in the migration guide.
Adds prepend: true
to emotion createCache
const cache = emotionCreateCache({
key: 'css',
+ prepend: true,
});
npx @mui/codemod v5.0.0/create-theme <path>
Renames ExpansionPanel*
to Accordion*
npx @mui/codemod v5.0.0/expansion-panel-component <path>
You can find more details about this breaking change in the migration guide.
-<Fab variant="round" />
+<Fab variant="circular" />
npx @mui/codemod v5.0.0/fab-variant <path>
You can find more details about this breaking change in the migration guide.
Renames the fade
style utility import and calls to alpha
.
-import { fade, lighten } from '@material-ui/core/styles';
+import { alpha, lighten } from '@material-ui/core/styles';
-const foo = fade('#aaa');
+const foo = alpha('#aaa');
npx @mui/codemod v5.0.0/fade-rename-alpha <path>
You can find more details about this breaking change in the migration guide.
Renames Grid
's justify
prop to justifyContent
.
-<Grid justify="left">Item</Grid>
+<Grid item justifyContent="left">Item</Grid>
npx @mui/codemod v5.0.0/grid-justify-justifycontent <path>
You can find more details about this breaking change in the migration guide.
Renames GridList*
to ImageList*
npx @mui/codemod v5.0.0/grid-list-component <path>
You can find more details about this breaking change in the migration guide.
Adds size="large"
if size
is not defined to get the same appearance as v4.
-<IconButton size="medium" />
-<IconButton />
+<IconButton size="medium" />
+<IconButton size="large" />
npx @mui/codemod v5.0.0/icon-button-size <path>
You can find more details about this breaking change in the migration guide.
Replace JSS styling with makeStyles
or withStyles
to styled
API.
import Typography from '@material-ui/core/Typography';
-import makeStyles from '@material-ui/styles/makeStyles';
+import { styled } from '@material-ui/core/styles';
-const useStyles = makeStyles((theme) => ({
- root: {
- display: 'flex',
- alignItems: 'center',
- backgroundColor: theme.palette.primary.main
- },
- cta: {
- borderRadius: theme.shape.radius.
- },
- content: {
- color: theme.palette.common.white,
- fontSize: 16,
- lineHeight: 1.7
- },
-}))
+const PREFIX = 'MyCard';
+const classes = {
+ root: `${PREFIX}-root`,
+ cta: `${PREFIX}-cta`,
+ content: `${PREFIX}-content`,
+}
+const Root = styled('div')((theme) => ({
+ [`&.${classes.root}`]: {
+ display: 'flex',
+ alignItems: 'center',
+ backgroundColor: theme.palette.primary.main
+ },
+ [`& .${classes.cta}`]: {
+ borderRadius: theme.shape.radius.
+ },
+ [`& .${classes.content}`]: {
+ color: theme.palette.common.white,
+ fontSize: 16,
+ lineHeight: 1.7
+ },
+}))
export const MyCard = () => {
const classes = useStyles();
return (
- <div className={classes.root}>
+ <Root className={classes.root}>
<Typography className={classes.content}>...</Typography>
<Button className={classes.cta}>Go</Button>
+ </Root>
- </div>
)
}
npx @mui/codemod v5.0.0/jss-to-styled <path>
You can find more details about this breaking change in the migration guide.
Note: This approach converts the first element in the return statement into styled component but also increases CSS specificity to override nested children. This codemod should be adopted after handling all breaking changes, check out the migration documentation
Apply underline="hover"
to <Link />
that does not define underline
prop (to get the same behavior as in v4).
-<Link />
+<Link underline="hover" />
npx @mui/codemod v5.0.0/icon-button-size <path>
You can find more details about this breaking change in the migration guide.
Moves JSS imports to @material-ui/styles
-import {
- createGenerateClassName,
- createStyles,
- jssPreset,
- makeStyles,
- ServerStyleSheets,
- useThemeVariants,
- withStyles,
- withTheme,
- ThemeProvider,
- styled,
- getStylesCreator,
- mergeClasses,
-} from '@material-ui/core/styles';
+import { ThemeProvider, styled } from '@material-ui/core/styles';
+import createGenerateClassName from '@material-ui/styles/createGenerateClassName';
+import createStyles from '@material-ui/styles/createStyles';
+import jssPreset from '@material-ui/styles/jssPreset';
+import makeStyles from '@material-ui/styles/makeStyles';
+import ServerStyleSheets from '@material-ui/styles/ServerStyleSheets';
+import useThemeVariants from '@material-ui/styles/useThemeVariants';
+import withStyles from '@material-ui/styles/withStyles';
+import withTheme from '@material-ui/styles/withTheme';
+import getStylesCreator from '@material-ui/styles/getStylesCreator';
import mergeClasses from '@material-ui/styles/mergeClasses';
npx @mui/codemod v5.0.0/material-ui-styles <path>
Renames Omit
import from @material-ui/types
to DistributiveOmit
-import { Omit } from '@material-ui/types';
+import { DistributiveOmit } from '@material-ui/types';
npx @mui/codemod v5.0.0/material-ui-types <path>
You can find more details about this breaking change in the migration guide.
Removes disableBackdropClick
and onEscapeKeyDown
from <Modal>
<Modal
- disableBackdropClick
- onEscapeKeyDown={handleEscapeKeyDown}
/>
npx @mui/codemod v5.0.0/modal-props <path>
You can find more details about this breaking change in the migration guide.
Updates all imports for @material-ui/lab
components that have moved to @material-ui/core
.
-import Skeleton from '@material-ui/lab/Skeleton';
+import Skeleton from '@material-ui/core/Skeleton';
or
-import { SpeedDial } from '@material-ui/lab';
+import { SpeedDial } from '@material-ui/core';
npx @mui/codemod v5.0.0/moved-lab-modules <path>
You can find more details about this breaking change in the migration guide.
Renames Pagination*
's shape
values from 'round' to 'circular'.
-<Pagination shape="round" />
-<PaginationItem shape="round" />
+<Pagination shape="circular" />
+<PaginationItem shape="circular" />
npx @mui/codemod v5.0.0/pagination-round-circular <path>
You can find more details about this breaking change in the migration guide.
Fix private import paths.
-import red from '@material-ui/core/colors/red';
-import createTheme from '@material-ui/core/styles/createTheme';
+import { red } from '@material-ui/core/colors';
+import { createTheme } from '@material-ui/core/styles';
npx @mui/codemod v5.0.0/optimal-imports <path>
Removes RootRef
from the codebase.
npx @mui/codemod v5.0.0/root-ref <path>
You can find more details about this breaking change in the migration guide.
-<Skeleton vairiant="circle" />
-<Skeleton vairiant="rect" />
+<Skeleton vairiant="circular" />
+<Skeleton vairiant="rectangular" />
npx @mui/codemod v5.0.0/skeleton-variant <path>
You can find more details about this breaking change in the migration guide.
Applies StyledEngineProvider
to the files that contains ThemeProvider
.
npx @mui/codemod v5.0.0/styled-engine-provider <path>
You can find more details about this breaking change in the migration guide.
Renames props in Table*
components.
-<>
- <TablePagination onChangeRowsPerPage={() => {}} onChangePage={() => {}} />
- <TablePagination classes={{ input: 'foo' }} />
- <Table padding="default" />
- <TableCell padding="default" />
-</>
+<>
+ <TablePagination onRowsPerPageChange={() => {}} onPageChange={() => {}} />
+ <TablePagination classes={{ select: 'foo' }} />
+ <Table padding="normal" />
+ <TableCell padding="normal" />
+</>
npx @mui/codemod v5.0.0/table-props <path>
You can find more details about this breaking change in the migration guide.
Renames the Tabs
's scrollButtons
prop values.
-<Tabs scrollButtons="on" />
-<Tabs scrollButtons="desktop" />
-<Tabs scrollButtons="off" />
+<Tabs scrollButtons allowScrollButtonsMobile />
+<Tabs scrollButtons />
+<Tabs scrollButtons={false} />
npx @mui/codemod v5.0.0/tabs-scroll-buttons <path>
You can find more details about this breaking change in the migration guide.
Renames TextField
's rows props.
-<TextField rowsMin={3} rowsMax={6} />
-<TextareaAutosize rows={2} />
-<TextareaAutosize rowsMin={3} rowsMax={6} />
+<TextField minRows={3} maxRows={6} />
+<TextareaAutosize minRows={2} />
+<TextareaAutosize minRows={3} maxRows={6} />
npx @mui/codemod v5.0.0/textarea-minmax-rows <path>
You can find more details about this breaking change in the migration guide.
Adds DefaultTheme
module augmentation to typescript projects.
npx @mui/codemod v5.0.0/theme-augment <path>
You can find more details about this breaking change in the migration guide.
Updates breakpoint values to match new logic.
-theme.breakpoints.down('sm')
-theme.breakpoints.between('sm', 'md')
+theme.breakpoints.down('md')
+theme.breakpoints.between('sm', 'lg')
npx @mui/codemod v5.0.0/theme-breakpoints <path>
You can find more details about this breaking change in the migration guide.
Renames theme.breakpoints.width('md')
to theme.breakpoints.values.md
.
npx @mui/codemod v5.0.0/theme-breakpoints-width <path>
You can find more details about this breaking change in the migration guide.
-import { ThemeOptions } from '@material-ui/core';
+import { DeprecatedThemeOptions } from '@material-ui/core';
npx @mui/codemod v5.0.0/theme-options <path>
Renames type
to mode
.
- { palette: { type: 'dark' } }
+ { palette: { mode: 'dark' } }
-theme.palette.type === 'dark'
+theme.palette.mode === 'dark'
npx @mui/codemod v5.0.0/theme-palette-mode <path>
You can find more details about this breaking change in the migration guide.
Renames MuiThemeProvider
to ThemeProvider
.
npx @mui/codemod v5.0.0/theme-provider <path>
You can find more details about this breaking change in the migration guide.
Removes the 'px' suffix from some template strings.
-`${theme.spacing(2)}px`
-`${theme.spacing(2)}px ${theme.spacing(4)}px`
+`${theme.spacing(2)}`
+`${theme.spacing(2)} ${theme.spacing(4)}`
npx @mui/codemod v5.0.0/theme-spacing <path>
You can find more details about this breaking change in the migration guide.
Renames theme.typography.round($number)
to Math.round($number * 1e5) / 1e5
.
-`${theme.typography.round($number)}`
+`${Math.round($number * 1e5) / 1e5}`
npx @mui/codemod v5.0.0/theme-typography-round <path>
You can find more details about this breaking change in the migration guide.
Renames import transitions
to createTransitions
npx @mui/codemod v5.0.0/transitions <path>
Renames useAutocomplete
related import from lab to core
-import useAutocomplete from '@material-ui/lab/useAutocomplete';
+import useAutocomplete from '@material-ui/core/useAutocomplete';
npx @mui/codemod v5.0.0/use-autocomplete <path>
Updates Dialog, Menu, Popover, and Snackbar to use the TransitionProps
prop to replace the onEnter*
and onExit*
props.
<Dialog
- onEnter={onEnter}
- onEntered={onEntered}
- onEntering={onEntering}
- onExit={onExit}
- onExited={onExited}
- onExiting={onExiting}
+ TransitionProps={{
+ onEnter,
+ onEntered,
+ onEntering,
+ onExit,
+ onExited,
+ onExiting,
+ }}
/>
npx @mui/codemod v5.0.0/use-transitionprops <path>
You can find more details about this breaking change in the migration guide.
Don't run this codemod if you already set
variant
tooutlined
orfilled
in theme default props.
Adds the TextField, Select, and FormControl's variant="standard"
prop when variant
is undefined.
The diff should look like this:
-<TextField value="Standard" />
+<TextField value="Standard" variant="standard" />
-<Select value="Standard" />
+<Select value="Standard" variant="standard" />
-<FormControl value="Standard" />
+<FormControl value="Standard" variant="standard" />
npx @mui/codemod v5.0.0/variant-prop <path>
Removes imported withMobileDialog
, and inserts hardcoded version to prevent application crash.
- import withMobileDialog from '@material-ui/core/withMobileDialog';
+ // FIXME checkout https://mui.com/guides/migration-v4/#dialog
+ const withMobileDialog = () => (WrappedComponent) => (props) => <WrappedComponent {...props} width="lg" fullScreen={false} />;
npx @mui/codemod v5.0.0/with-mobile-dialog <path>
You can find more details about this breaking change in the migration guide.
Removes withWidth
import, and inserts hardcoded version to prevent application crash.
- import withWidth from '@material-ui/core/withWidth';
+ // FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
+ const withWidth = () => (WrappedComponent) => (props) => <WrappedComponent {...props} width="xs" />;
npx @mui/codemod v5.0.0/with-width <path>
You can find more details about this breaking change in the migration guide.
Replace every occurrence of material-ui
related package with the new package names (listed below) except these packages (@material-ui/pickers
, @material-ui/data-grid
, @material-ui/x-grid
& @material-ui/x-grid-data-generator
). More details about why package names are changed
Material Design components
-import Alert from '@material-ui/core/Alert';
+import Alert from '@mui/material/Alert';
JSS styles package
-import { makeStyles } from '@material-ui/styles';
+import { makeStyles } from '@mui/styles';
System package
-import { SxProps } from '@material-ui/system';
+import { SxProps } from '@mui/system';
Utilities package
-import { deepmerge } from '@material-ui/utils';
+import { deepmerge } from '@mui/utils';
Lab
-import Mansory from '@material-ui/lab/Mansory';
+import Mansory from '@mui/lab/Mansory';
Dependencies
// package.json
-"@material-ui/core": "next",
-"@material-ui/icons": "next",
-"@material-ui/lab": "next",
-"@material-ui/unstyled": "next",
-"@material-ui/styled-engine-sc": "next",
+"@mui/material": "next",
+"@mui/icons-material": "next",
+"@mui/lab": "next",
+"@mui/core": "next",
+"@mui/styled-engine-sc": "next",
npx @mui/codemod v5.0.0/mui-replace <path>
You can find more details about this breaking change in the migration guide.
Updates the theme-spacing-api
from theme.spacing.unit x
to theme.spacing(x)
.
The diff should look like this:
-const spacing = theme.spacing.unit;
+const spacing = theme.spacing(1);
npx @mui/codemod v4.0.0/theme-spacing-api <path>
This codemod tries to perform a basic expression simplification which can be improved for expressions that use more than one operation.
-const spacing = theme.spacing.unit / 5;
+const spacing = theme.spacing(0.2);
// Limitation
-const spacing = theme.spacing.unit * 5 * 5;
+const spacing = theme.spacing(5) * 5;
Converts all @material-ui/core
imports more than 1 level deep to the optimal form for tree shaking:
-import withStyles from '@material-ui/core/styles/withStyles';
-import createTheme from '@material-ui/core/styles/createTheme';
+import { withStyles, createTheme } from '@material-ui/core/styles';
npx @mui/codemod v4.0.0/optimal-imports <path>
Head to https://mui.com/guides/minimizing-bundle-size/ to understand when it's useful.
Converts all @material-ui/core
submodule imports to the root module:
-import List from '@material-ui/core/List';
-import { withStyles } from '@material-ui/core/styles';
+import { List, withStyles } from '@material-ui/core';
npx @mui/codemod v4.0.0/top-level-imports <path>
Head to https://mui.com/guides/minimizing-bundle-size/ to understand when it's useful.
Updates the import-paths
for the new location of the components.
MUI v1.0.0 flatten the import paths.
The diff should look like this:
-import { MenuItem } from '@material-ui/core/Menu';
+import MenuItem from '@material-ui/core/MenuItem';
npx @mui/codemod v1.0.0/import-path <path>
Notice: if you are migrating from pre-v1.0, and your imports use material-ui
, you will need to manually find and replace all references to material-ui
in your code to @material-ui/core
. E.g.:
-import Typography from 'material-ui/Typography';
+import Typography from '@material-ui/core/Typography';
Subsequently, you can run the above find ...
command to flatten your imports.
Updates the color-imports
for the new location of MUI color palettes.
The diff should look like this:
-import { blue, teal500 } from 'material-ui/styles/colors';
+import blue from '@material-ui/core/colors/blue';
+import teal from '@material-ui/core/colors/teal';
+const teal500 = teal['500'];
npx @mui/codemod v1.0.0/color-imports <path>
additional options
npx @mui/codemod v1.0.0/color-imports <path> -- --importPath='mui/styles/colors' --targetPath='mui/colors'
Updates the svg-icons
import paths from material-ui/svg-icons/<category>/<icon-name>
to @material-ui/icons/<IconName>
, to use the new @material-ui/icons
package.
The diff should look like this:
-import AccessAlarmIcon from 'material-ui/svg-icons/device/AccessAlarm';
-import ThreeDRotation from 'material-ui/svg-icons/action/ThreeDRotation';
+import AccessAlarmIcon from '@material-ui/icons/AccessAlarm';
+import ThreeDRotation from '@material-ui/icons/ThreeDRotation';
npx @mui/codemod v1.0.0/svg-icon-imports <path>
Updates the import-paths
for the new location of the components.
MUI v0.15.0 is reorganizing the folder distribution of the project.
The diff should look like this:
// From the source
-import FlatButton from 'material-ui/src/flat-button';
+import FlatButton from 'material-ui/src/FlatButton';
// From npm
-import RaisedButton from 'material-ui/lib/raised-button';
+import RaisedButton from 'material-ui/RaisedButton';
npx @mui/codemod v0.15.0/import-path <path>