Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-mui-unused-classes

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-mui-unused-classes - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

debug.js

2

package.json
{
"name": "eslint-plugin-mui-unused-classes",
"version": "2.0.0",
"version": "2.0.1",
"description": "eslint plugin to detect unused material-ui styling classes",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -57,2 +57,7 @@ function getBasicIdentifier(node) {

});
} else if (
body.type === 'CallExpression' &&
body.callee.name === 'createStyles' &&
body.arguments[0].type === 'ObjectExpression') {
stylesObj = body.arguments[0]
}

@@ -59,0 +64,0 @@

@@ -60,2 +60,16 @@

}`,
// valid createStyles case
`const useStyles = makeStyles(theme =>
createStyles({
usedClass: {
backgroundColor: 'hotpink',
},
}),
);
export const Component = () => {
const classes = useStyles();
return <div className={classes.usedClass}>test</div>;
};`
],

@@ -131,4 +145,25 @@ invalid: [

}]
},
// invalid case using createStyles
{
code: `
const useStyles = makeStyles(theme =>
createStyles({
testClass: {
backgroundColor: 'red',
},
usedClass: {
backgroundColor: 'hotpink',
},
}),
);
export const Component = () => {
const classes = useStyles();
return <div className={classes.usedClass}>test</div>;
};`,
errors: [{ message: 'Class `testClass` is unused'}]
}
],
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc