{"id":19711,"library":"eslint-plugin-clsx","title":"eslint-plugin-clsx","description":"ESLint plugin for clsx/classnames utility libraries providing 8 rules to enforce best practices and reduce redundant code. Current stable version 0.0.12 (0.1.0 available), active maintenance with regular releases. Supports ESLint 8, 9, and 10. Ships TypeScript types. Differentiators: auto-fixable rules, recommended and all presets, flat config support, settings for custom import names.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/temoncher/eslint-plugin-clsx","tags":["javascript","eslint","eslintplugin","eslint-plugin","clsx","classnames","typescript"],"install":[{"cmd":"npm install eslint-plugin-clsx","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-clsx","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-clsx","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run","package":"eslint","optional":false}],"imports":[{"note":"Default import is the plugin object. CJS require works but may lack type definitions.","wrong":"const clsx = require('eslint-plugin-clsx')","symbol":"default","correct":"import clsx from 'eslint-plugin-clsx'"},{"note":"Use flat configs for ESLint 9+. Legacy configs available via plugin:clsx/recommended.","wrong":"clsx.configs.recommended","symbol":"configs.flat.recommended","correct":"clsx.configs.flat.recommended"},{"note":"Named export for accessing individual rule definitions.","wrong":"const rules = require('eslint-plugin-clsx').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-clsx'"}],"quickstart":{"code":"import clsx from 'eslint-plugin-clsx';\nimport { defineConfig } from 'eslint/config';\n\nexport default defineConfig({\n  plugins: { clsx },\n  rules: {\n    'clsx/no-redundant-clsx': 'error',\n    'clsx/forbid-array-expressions': 'warn',\n    'clsx/forbid-false-inside-object-expressions': 'warn',\n    'clsx/forbid-true-inside-object-expressions': 'warn',\n    'clsx/no-spreading': 'warn',\n    'clsx/prefer-merged-neighboring-elements': 'warn'\n  }\n});\n// Also works with flat config preset:\n// export default defineConfig(clsx.configs.flat.recommended);","lang":"typescript","description":"Enable recommended rules with specific overrides in flat config format for ESLint 9+."},"warnings":[{"fix":"Update to >=0.0.2 and use TypeScript or ensure CJS compatibility","message":"v0.0.2 switched to TypeScript - existing CJS require may need update","severity":"breaking","affected_versions":"<0.0.2"},{"fix":"Use only top-level imports from 'eslint-plugin-clsx'","message":"v0.0.7 cleanup published files - may break import paths if using deep imports","severity":"breaking","affected_versions":"<0.0.7"},{"fix":"Stick to documented options schema","message":"v0.0.12 disallow extra properties in rule options - custom options may become invalid","severity":"breaking","affected_versions":"<0.0.12"},{"fix":"Install supported ESLint version","message":"Requires ESLint 8, 9, or 10 as peer dependency - not compatible with other versions","severity":"gotcha","affected_versions":"*"},{"fix":"Migrate to flat config using clsx.configs.flat.recommended","message":"Legacy .eslintrc configs still work but flat configs are preferred for ESLint 9+","severity":"deprecated","affected_versions":">=0.0.11"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install eslint-plugin-clsx --save-dev","cause":"Missing installation or incorrect module resolution","error":"Error: Failed to load plugin 'clsx': Cannot find module 'eslint-plugin-clsx'"},{"fix":"Use: import clsx from 'eslint-plugin-clsx'; then clsx.configs.flat.recommended","cause":"Attempting to access configs without proper import in flat config","error":"TypeError: Cannot read properties of undefined (reading 'recommended')"},{"fix":"Set rule to 'off', 'warn', or 'error' (not boolean or string like 'true')","cause":"Invalid severity level in rule configuration","error":"Configuration for rule 'clsx/no-redundant-clsx' is invalid: severity must be 'off', 'warn', or 'error'."},{"fix":"Switch to flat config format or ensure ESLint 8 compatibility","cause":"Using legacy config syntax with ESLint 9+ flat config only project","error":"ESLint configuration in .eslintrc.json is invalid: \"extends\": [\"plugin:clsx/recommended\"] is not a valid configuration."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}