question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Codemod for migration from `@material-ui/styles`'s `makeStyles` to `tss-react`

See original GitHub issue

Hi,

I am trying to start a discussion to see if it is possible/feasible to create a codemod that would migrate from @material-ui/styles makeStyles and withStyles to the tss-react’s equivalents.

The motivation is to help the developers to migrate from @materia-ui/core (v4) to @mui/material (v5) in a more automated way. From what I was seeing from time to time in the activity of the project, looks like most (all?) features that @material-ui/styles’ API provided are already implemented. If this is the case, I would like to hear your opinion, on whether you think this could actually be automated, or there are things that are still depending on a person being involved when migrating.

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:11
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
garronejcommented, Oct 27, 2021

Hi @mnajdova,
I am off today but trust that I will try and see what’s feasable.

2reactions
ryancogswellcommented, Mar 14, 2022

@garronej @mnajdova The app I work on has over 500 usages of makeStyles, so I’m going to start working on the codemod. I’ll only be able to devote occasional blocks of time to this, but we are planning to migrate our app to v5 within the next quarter so I should finish it within the next couple months. I’ll be focusing on just the patterns that occur within our code, but that will cover enough cases to create a solid foundation to add more cases to.

I haven’t used jscodeshift before, but the examples already in https://github.com/mui/material-ui/tree/master/packages/mui-codemod/src/v5.0.0 give me enough to speed my learning along.

You can follow my progress here: #31802

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating from JSS (optional) - Material UI - MUI
We provide a codemod to help migrate JSS styles to styled API, ... import Typography from '@mui/material/Typography'; -import makeStyles from ...
Read more >
garronej/tss-react: makeStyles is dead, long live ... - GitHub
js 13 appDir 🥳 . 'tss-react' is intended to be the replacement for @material-ui v4 makeStyles and 'react-jss' . ✅ Seamless integration with...
Read more >
Setup - TSS React
If you are migrating from @material-ui/core (v4) to @mui/material (v5) checkout the migration guide from MUI's documentation website here.
Read more >
@mui/codemod - npm
jss-to-tss-react​​ Migrate JSS styling with makeStyles or withStyles to the corresponding tss-react API.
Read more >
Material UI v4 to v5 migration... Worth doing? : r/reactjs - Reddit
I recently upgraded a project (63k sloc) that made heavy use of makestyles over styled. It was a pain in the ass, TSS-React...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found