eslint-plugin-material-ui-unused-classes
eslint-plugin-material-ui-unused-classes copied to clipboard
Detects all classes as not used, even when they are
project made with create-react-app
using "react-scripts": "4.0.3"
heres the relevent package.json:
"eslintConfig": { "extends": [ "react-app", "react-app/jest" ], "plugins": [ "mui-unused-classes" ], "rules": { "mui-unused-classes/unused-classes": 1 } }, "devDependencies": { "eslint-plugin-mui-unused-classes": "^1.0.3" }
shows errors:
even though the classes/styles are used:
🤔 what am i doing wrong?
i'm seeing the same result, using makeStyles()
, maybe that's the issue?
Were you able to solve the problem? I have the exact same issue.
v1 of this plugin expects you to instantiate your styles as
const classes = useStyles()
v2 (which I just released) is more flexible, you should be able to name your hook and the classes instance however you like.