Open dwjohnston opened 2 years ago
Experiencing the same issue
If my understanding is correct, we have to add the logic to read the import file and do the correct transformation on both declaration & usage files.
🤔 I am not sure if we want to do this (it is good for sure if we can do it but it sounds really complicated to me as we have other priorities in our backlog). Anyway, if anyone would like to work on this, I'm very appreciate to review the PR.
Duplicates
Latest version
Current behavior 😯
When running the migration steps to migrate JSS to emotion documented here
We run:
However, any styles contained a single file without an accompanying component where they are used, will not migrate properly. You will get this error:
ie.
This is OK:
This is not:
Expected behavior 🤔
I mean, I guess make the tool work for this import.
Steps to reproduce 🕹
Steps:
npx @mui/codemod v5.0.0/jss-to-styled src
Context 🔦
Migrating to v5. The code base I'm working in has the convention of keeping styles for components in a styles.ts file.
Your environment 🌎
`npx @mui/envinfo`
``` System: OS: macOS 12.3.1 Binaries: Node: 16.14.0 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.3.1 - /usr/local/bin/npm Browsers: Chrome: 100.0.4896.75 Edge: Not Found Firefox: Not Found Safari: 15.4 npmPackages: @emotion/react: ^11.8.2 => 11.8.2 @emotion/styled: ^11.8.1 => 11.8.1 @mui/base: 5.0.0-alpha.74 @mui/icons-material: ^5.5.1 => 5.5.1 @mui/lab: ^5.0.0-alpha.75 => 5.0.0-alpha.75 @mui/material: ^5.5.3 => 5.5.3 @mui/private-theming: 5.5.3 @mui/styled-engine: 5.5.2 @mui/styles: ^5.5.3 => 5.5.3 @mui/system: 5.5.3 @mui/types: 7.1.3 @mui/utils: 5.5.3 @types/react: 17.0.42 => 17.0.42 react: 17.0.2 => 17.0.2 react-dom: 17.0.1 => 17.0.1 styled-components: ^5.2.1 => 5.3.3 typescript: 4.2.2 => 4.2.2 npm notice npm notice New minor version of npm available! 8.3.1 -> 8.6.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.6.0 npm notice Run npm install -g npm@8.6.0 to update! npm notice ```