add fixer logic for aliases
Signed-off-by: Juan Pablo Garcia Ripa <sarabadu@gmail.com>
This commit is contained in:
@@ -35,6 +35,9 @@ ruleTester.run('path-imports-rule', rule, {
|
||||
{
|
||||
code: `import { styled, withStyles } from '@material-ui/core/styles';`,
|
||||
},
|
||||
{
|
||||
code: `import { WithStyles } from '@material-ui/core/styles';`,
|
||||
},
|
||||
{
|
||||
code: `import SvgIcon, { SvgIconProps } from '@material-ui/core/SvgIcon';`,
|
||||
},
|
||||
@@ -62,6 +65,11 @@ import Typography from '@material-ui/core/Typography';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import { ThemeProvider } from '@material-ui/core/styles';`,
|
||||
},
|
||||
{
|
||||
code: `import { WithStyles } from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import { WithStyles } from '@material-ui/core/styles';`,
|
||||
},
|
||||
{
|
||||
code: `import { Grid, GridProps, Theme, makeStyles } from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
@@ -83,6 +91,8 @@ import SvgIcon, { SvgIconProps } from '@material-ui/core/SvgIcon';`,
|
||||
Grid,
|
||||
makeStyles,
|
||||
ThemeProvider,
|
||||
WithStyles,
|
||||
Tooltip as MaterialTooltip,
|
||||
} from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import Box from '@material-ui/core/Box';
|
||||
@@ -90,7 +100,8 @@ import DialogActions from '@material-ui/core/DialogActions';
|
||||
import DialogContent from '@material-ui/core/DialogContent';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import { makeStyles, ThemeProvider } from '@material-ui/core/styles';`,
|
||||
import MaterialTooltip from '@material-ui/core/Tooltip';
|
||||
import { makeStyles, ThemeProvider, WithStyles } from '@material-ui/core/styles';`,
|
||||
},
|
||||
{
|
||||
code: `import { Box, Button, makeStyles } from '@material-ui/core';`,
|
||||
@@ -121,5 +132,25 @@ import { styled, withStyles } from '@material-ui/core/styles';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import { TabProps } from '@material-ui/core/Tab';`,
|
||||
},
|
||||
{
|
||||
code: `import { Tooltip as MaterialTooltip, } from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import MaterialTooltip from '@material-ui/core/Tooltip';`,
|
||||
},
|
||||
{
|
||||
code: `import { SvgIcon as Icon, SvgIconProps as IconProps } from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import Icon, { SvgIconProps as IconProps } from '@material-ui/core/SvgIcon';`,
|
||||
},
|
||||
{
|
||||
code: `import { SvgIconProps as IconProps } from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import { SvgIconProps as IconProps } from '@material-ui/core/SvgIcon';`,
|
||||
},
|
||||
{
|
||||
code: `import { styled as s } from '@material-ui/core';`,
|
||||
errors: [{ messageId: 'topLevelImport' }],
|
||||
output: `import { styled as s } from '@material-ui/core/styles';`,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user