Custom ESLint rules for MUI.
Note: This is a fork of eslint-plugin-mui that seems to be not being worked on.
You'll first need to install ESLint:
npm install eslint --save-dev
Next, install @rkristelijn/eslint-plugin-mui
:
npm install @rkristelijn/eslint-plugin-mui --save-dev
Add mui
to the plugins section of your eslint.config.cjs
configuration file.
const muiPlugin = require('eslint-plugin-mui');
module.exports = [
plugins: {
mui: muiPlugin,
},
rules: {
// adding the recommended rules
'mui/sort-sx-keys': 'warn',
'mui/prefer-named-imports': 'warn',
'mui/no-literal-colors': 'warn',
'mui/no-grid-alias': 'warn'
'mui/no-single-child-in-grid': 'warn',
'mui/no-single-child-in-stack': 'warn'
},
]
- sort-sx-keys
- prefer-named-imports
- no-literal-color
- no-grid-alias
- no-single-child-in-grid
- no-single-child-in-stack
This plugin is based on eslint-plugin-sort-keys-fix (https://github.com/leo-buneev/eslint-plugin-sort-keys-fix).
- rkristelijn
- rafaelgomesxyz (original author)