This eslint plugin lets you detect unused Material UI classes:
- Add the dependency:
npm i --save-dev eslint-plugin-mui-unused-classes
- Add it at the end of your plugin list in your
.eslintrc.js
:
module.exports = {
// ...
plugins: [
// ...
'mui-unused-classes'
]
}
That's it! You should now get a warning if you have unused classes. One could also make it an error by adding the actual rule to the rule
entry in .eslintrc.js
:
module.exports = {
// ...
plugins: [
// ...
'mui-unused-classes'
],
rules: {
'mui-unused-classes/unused-classes': 2
}
}