Skip to content
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

[codemod] The jss-to-tss codemod does not match import makeStyles from '@mui/styles/makeStyles' #32935

Closed
2 tasks done
danwexler opened this issue May 27, 2022 · 2 comments · Fixed by #32962
Closed
2 tasks done
Labels
package: codemod Specific to @mui/codemod

Comments

@danwexler
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

If your existing codebase uses the following import, it will be skipped by the jss-to-tss codemod:
import makeStyles from '@mui/styles/makeStyles'

I believe the failure is at jss-to-tss-react.js:186, where the existing checks do not include the fully-qualified include subfile.

This was true for all files in my codebase, so when I ran the codemod, it did not modify any files, which was very confusing.

Expected behavior 🤔

The codemod should catch this case, or at least warn in the documentation so that folks can do a global search-and-replace.

Steps to reproduce 🕹

Steps:

  1. Create a file that uses import makeStyles from '@mui/styles/makeStyles' and makeStyles
  2. Run the codemod
  3. Notice that the file was skipped

Context 🔦

Migration from v4 to v5 with tss-react

Your environment 🌎

`npx @mui/envinfo`
Using Chrome 102:

  System:
    OS: macOS 12.4
  Binaries:
    Node: 14.19.1 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.16 - /usr/local/bin/npm
  Browsers:
    Chrome: 102.0.5005.61
    Edge: Not Found
    Firefox: 93.0
    Safari: 15.5
  npmPackages:
    @emotion/react: ^11.9.0 => 11.9.0 
    @emotion/styled: ^11.8.1 => 11.8.1 
    @mui/base:  5.0.0-alpha.82 
    @mui/icons-material: ^5.8.0 => 5.8.0 
    @mui/material: ^5.8.1 => 5.8.1 
    @mui/private-theming:  5.8.0 
    @mui/styled-engine:  5.8.0 
    @mui/system:  5.8.1 
    @mui/types:  7.1.3 
    @mui/utils:  5.8.0 
    @types/react: 17.0.45 => 17.0.45 
    react: 17.0.2 => 17.0.2 
    react-dom: 17.0.2 => 17.0.2 
    typescript: 4.7.2 => 4.7.2 ```
</details>
@danwexler danwexler added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 27, 2022
joshkel added a commit to joshkel/material-ui that referenced this issue May 31, 2022
@ZeeshanTamboli ZeeshanTamboli added package: codemod Specific to @mui/codemod and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 2, 2022
@drewscott16
Copy link

I had the same issue and joshkel's commit seems to have fixed it for me!

@danwexler
Copy link
Author

danwexler commented Jun 9, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: codemod Specific to @mui/codemod
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants