Skip to content

Commit

Permalink
Support @mui/lab
Browse files Browse the repository at this point in the history
  • Loading branch information
kajirikajiri committed Nov 30, 2022
1 parent 3969445 commit f2fbd49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/mui-path-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
return {
ImportDeclaration(node) {
const validationTargets = [
"@mui/material", "@mui/icons-material"
"@mui/material", "@mui/icons-material", "@mui/lab"
]
const allowNamedImports = [
"Theme", "SvgIconTypeMap"
Expand Down
14 changes: 14 additions & 0 deletions tests/lib/rules/mui-path-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ ruleTester.run("rule", rule, {
{
code: `import Add from "@mui/icons-material/Add";`
},
{
code: `import TreeView from "@mui/lab/TreeView";`
},
{
code: `import { Theme } from "@mui/material";`
},
Expand Down Expand Up @@ -54,6 +57,11 @@ ruleTester.run("rule", rule, {
errors: [{ message: "error: !mui-toplevel-import", type: "" }],
output: `import Box from "@mui/material/Box";`
},
{
code: `import { TreeView } from "@mui/lab";`,
errors: [{ message: "error: !mui-toplevel-import", type: "" }],
output: `import TreeView from "@mui/lab/TreeView";`
},
{
code: `import { Add, Link } from "@mui/icons-material";`,
errors: [{ message: "error: !mui-toplevel-import", type: "" }],
Expand All @@ -71,6 +79,12 @@ import Card from "@mui/material/Card";`
errors: [{ message: "error: !mui-toplevel-import", type: "" }],
output: `import Box from "@mui/material/Box";
import { Theme } from "@mui/material";`,
},
{
code: `import { TreeView, TreeItem } from "@mui/lab";`,
errors: [{ message: "error: !mui-toplevel-import", type: "" }],
output: `import TreeView from "@mui/lab/TreeView";
import TreeItem from "@mui/lab/TreeItem";`,
},
{
code: `import { Box, Theme, SvgIconTypeMap } from "@mui/material";`,
Expand Down

0 comments on commit f2fbd49

Please sign in to comment.