{"id":19963,"library":"eslint-plugin-tss-unused-classes","title":"ESLint plugin for tss-react unused classes","description":"An ESLint plugin that detects unused styling classes created with tss-react (the CSS-in-JS library for Material-UI). Current stable version is 1.0.3. The plugin is actively maintained by the tss-react author. It works by analyzing calls to makeStyles and checking if returned class names are referenced in JSX. Unlike general unused class linters, this one is tightly integrated with tss-react's API, reducing false positives. It has no runtime dependencies and supports ESLint 7/8/9.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/garronej/eslint-plugin-tss-unused-classes","tags":["javascript","eslint","tss-react","material-ui","mui","jss"],"install":[{"cmd":"npm install eslint-plugin-tss-unused-classes","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-tss-unused-classes","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-tss-unused-classes","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, plugin runs within ESLint","package":"eslint","optional":false}],"imports":[{"note":"This is an ESLint plugin, not a module. Configure via eslint config.","wrong":"// Do not import as a module in JS; it's an ESLint plugin","symbol":"plugin","correct":"// In .eslintrc.js: plugins: ['tss-unused-classes'], rules: { 'tss-unused-classes/unused-classes': 'warn' }"},{"note":"The rule is namespaced under the plugin name; prefix with 'tss-unused-classes/'.","wrong":"'tss-unused-classes': 'warn'","symbol":"unused-classes rule","correct":"'tss-unused-classes/unused-classes': 'warn'"},{"note":"Disable comments must use the full rule name with plugin prefix.","wrong":"// eslint-disable-next-line unused-classes","symbol":"// eslint-disable-next-line","correct":"// eslint-disable-next-line tss-unused-classes/unused-classes"}],"quickstart":{"code":"// 1. Install: yarn add --dev eslint-plugin-tss-unused-classes\n// 2. Configure .eslintrc.js:\nmodule.exports = {\n  plugins: ['tss-unused-classes'],\n  rules: {\n    'tss-unused-classes/unused-classes': 'warn'\n  }\n};\n// 3. In a React component using tss-react:\nimport { makeStyles } from 'tss-react/mui';\n\nconst useStyles = makeStyles()((theme) => ({\n  root: { color: 'red' },\n  unusedRoot: { color: 'blue' }\n}));\n\nexport function MyComponent() {\n  const { classes } = useStyles();\n  // Want to use classes.root but forgot? Plugin will warn about classes.unusedRoot\n  return <div className={classes.root}>Hello</div>;\n}","lang":"javascript","description":"Setup and example of detecting unused tss-react classes with ESLint."},"warnings":[{"fix":"Ensure makeStyles()() call returns an object with class names as keys.","message":"The plugin only works with the object syntax of makeStyles (not with the callback returning CSSProperties directly if used without object wrapper).","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Disable the rule on that line with eslint-disable-next-line comment.","message":"False positives may occur if classes are used via string interpolation or dynamic access (e.g., classes[`${name}`]).","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Upgrade to ESLint 8 or 9.","message":"ESLint 7 is no longer supported as of version 1.0.0; check your ESLint version.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Update eslint config to use 'tss-unused-classes' instead of '@tss-unused-classes'.","message":"v1.0.0 dropped support for ESLint 6 and below, and changed rule prefix from @tss-unused-classes to tss-unused-classes.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'yarn add --dev eslint-plugin-tss-unused-classes' and add 'tss-unused-classes' to plugins array in .eslintrc.","cause":"Plugin not installed or not listed in plugins array.","error":"ESLint: Rule 'tss-unused-classes/unused-classes' was not found."},{"fix":"Set 'sourceType': 'module' in parserOptions, or use a babel parser for JSX.","cause":"ESLint is not configured for ES modules.","error":"Parsing error: The keyword 'import' is reserved"},{"fix":"Use 'tss-unused-classes/unused-classes' without @.","cause":"Using legacy format with @ prefix in older versions.","error":"Warning: Rule 'tss-unused-classes/unused-classes' has been deprecated (note: not actually deprecated, but may appear if using old config format)."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}