eslint-plugin-material-ui-path-imports
v0.0.3
Published
Use path import to avoid pulling in unused modules.
Downloads
81
Maintainers
Readme
All credits go to https://github.com/kajirikajiri/eslint-plugin-mui-path-imports
import { Box } from '@material-ui/core';
to
import Box from '@material-ui/core/Box';
Material-UI path imports
Use path import to avoid pulling in unused modules. Decreases waiting time.
Reduces about 10000 modules.
BEFORE
event - compiled successfully in 287 ms (11756 modules)
wait - compiling...
event - compiled successfully in 384 ms (11756 modules)
wait - compiling...
event - compiled successfully in 301 ms (11756 modules)
wait - compiling...
event - compiled successfully in 298 ms (11756 modules)
AFTER
event - compiled successfully in 69 ms (1867 modules)
wait - compiling...
event - compiled successfully in 72 ms (1867 modules)
wait - compiling...
event - compiled successfully in 64 ms (1867 modules)
wait - compiling...
event - compiled successfully in 84 ms (1867 modules)
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-material-ui-path-imports
:
npm install eslint-plugin-material-ui-path-imports --save-dev
Usage
Add plugin
and rules
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"material-ui-path-imports"
],
"rules": {
"material-ui-path-imports/material-ui-path-imports": "error"
}
}
And eslint --fix
import { Box } from '@material-ui/core';
↓
import Box from "@material-ui/core/Box";