mui-v4-create-mui-theme-to-v5-create-theme
Replace deprecated createMuiTheme usage from Material-UI v4-era imports with createTheme from @mui/material/styles, including deterministic import rewrites and call-site renaming in React JavaScript/TypeScript codebases.
What It Rewrites
import { createMuiTheme } from '@material-ui/core/styles'toimport { createTheme } from '@mui/material/styles'- aliased named imports such as
import { createMuiTheme as makeTheme } ...while preserving the local alias - namespace imports such as
import * as muiStyles from '@material-ui/core/styles'and member calls likemuiStyles.createMuiTheme(...) - CommonJS destructuring and namespace requires from
@material-ui/core/styles - named imports from
@material-ui/corewhen they bindcreateMuiTheme
What It Does Not Rewrite
- local functions or variables named
createMuiThemethat are not imported from targeted Material-UI packages - string literals, comments, or docs mentioning
createMuiTheme - already migrated
@mui/material/stylescreateThemeusage - theme option shape changes such as
palette.type; that belongs in a separate MUI v5 theme-options codemod
Scope
- processes
**/*.{js,jsx,ts,tsx,mjs,cjs} - excludes
node_modules,dist,build,.next, andcoverage
Usage
bash
Example
Before:
ts
After:
ts
Development
bash
License
MIT