@codemod/react-mui-jss-styles-to-tss-react-hook-migration
Transform React components using Material UI JSS APIs (e.g., makeStyles/withStyles/createStyles) into strongly typed tss-react hook-based styling (makeStyles from tss-react/mui) in TypeScript React codebases, improving maintainability and type safety while modernizing legacy styling patterns.
Installation
bash
Usage
This codemod targets **/*.{ts,tsx} files that still import legacy styling helpers from @material-ui/core/styles, @material-ui/styles, or @mui/styles.
It currently rewrites these supported shapes:
makeStyles(...)imports and calls intomakeStyles()(... )fromtss-react/muicreateStyles(...)wrappers nested inside supportedmakeStylesorwithStylesstyle declarationsconst classes = useStyles(...)call sites intoconst { classes } = useStyles(...)withStyles(styles)(Component)whenComponentis a supported function component with an injectedclassesprop
The transform is intentionally conservative. It skips files when it cannot safely preserve behavior, including:
- files without JSX unless
--param allow-non-react=trueis set - unsupported or non-local
makeStylesfactories withStylesclass components- legacy style imports that are present but never used
Examples:
tsx
becomes:
tsx
Useful workflow params:
bash
Development
bash
License
MIT