Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed May 22, 2021
1 parent f5daf0e commit cdfcd7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/material-ui-codemod/src/v4.0.0/optimal-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export default function transformer(fileInfo, api, options) {
return;
case 'ImportDefaultSpecifier': {
const moduleName = match[2];
if (!whitelist.has(moduleName)) return;
if (!whitelist.has(moduleName) && moduleName !== 'withStyles') {
return;
}
addSpecifier(
targetImportPath,
j.importSpecifier(j.identifier(moduleName), j.identifier(localName)),
Expand Down
7 changes: 6 additions & 1 deletion packages/material-ui-codemod/src/v4.0.0/top-level-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ export default function transformer(fileInfo, api, options) {
break;
}
case 'ImportSpecifier':
if (whitelist[specifier.imported.name] == null) return;
if (
whitelist[specifier.imported.name] == null &&
specifier.imported.name !== 'withStyles'
) {
return;
}
resultSpecifiers.push(specifier);
path.get('specifiers', index).prune();
break;
Expand Down

0 comments on commit cdfcd7c

Please sign in to comment.