remove harcoded module

Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
This commit is contained in:
Juan Pablo Garcia Ripa
2024-04-10 23:09:21 +02:00
parent 2ab814f124
commit c56cfd8990
2 changed files with 11 additions and 4 deletions
@@ -204,7 +204,7 @@ module.exports = {
if (specifier.emitProp && !specifier.emitComponent) {
const replacement = `import { ${getNamedImportValue(
specifier,
)} } from '@material-ui/core/${specifier.componentValue}';`;
)} } from '${node.source.value}/${specifier.componentValue}';`;
replacements.push(replacement);
}
@@ -213,9 +213,9 @@ module.exports = {
replacements.push(
`import ${
specifier.componentAlias ?? specifier.componentValue
}, { ${getNamedImportValue(
specifier,
)} } from '@material-ui/core/${specifier.componentValue}';`,
}, { ${getNamedImportValue(specifier)} } from '${
node.source.value
}/${specifier.componentValue}';`,
);
}
}
@@ -154,5 +154,12 @@ import { styled, withStyles, alpha, duration } from '@material-ui/core/styles';`
errors: [{ messageId: 'topLevelImport' }],
output: `import { styled as s } from '@material-ui/core/styles';`,
},
{
code: `import { TreeItem, TreeItemProps, TreeView, AlertProps } from '@material-ui/lab';`,
errors: [{ messageId: 'topLevelImport' }],
output: `import TreeItem, { TreeItemProps } from '@material-ui/lab/TreeItem';
import TreeView from '@material-ui/lab/TreeView';
import { AlertProps } from '@material-ui/lab/Alert';`,
},
],
});