etn-ccis/blui-doc-it

Update eslint rules to prohibit importing from the root of @mui/material

Opened this issue · 1 comments

Describe the desired behavior

Add ESLint rules to prohibit importing from the root of @mui/material (using deep imports instead) to keep the bundle size down

Describe the current behavior

There is no rule in place

Is this request related to a current issue?

Additional Context

@joebochill can help with the structure for this

// .eslintrc.json
    "rules": {
        // MUI import restrictions
        // https://mui.com/material-ui/guides/minimizing-bundle-size/#option-one-use-path-imports
        "@typescript-eslint/no-restricted-imports": [
            "error",
            {
                "paths": [
                    {
                        "name": "@mui/material",
                        "message": "Import [module] from @mui/material/[module] instead"
                    }
                ]
            }
        ]
    },