{"id":19955,"library":"eslint-plugin-switch-case","title":"ESLint Plugin Switch Case","description":"An ESLint plugin providing switch-case-specific linting rules, including no-default-case, no-case-curly, and newline-between-switch-case. Current stable version is 4.0.0, released with support for ESLint ^9.8.0 or ^10.0.0 and Node.js ^20.19.0 || ^22.13.0 || >= 24. The plugin enforces stylistic and logic rules for switch statements, filling a niche not covered by ESLint core rules. It is maintained by lukeapage and is in active development.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/lukeapage/eslint-plugin-switch-case","tags":["javascript","eslint","eslint-plugin","eslintplugin","destructuring"],"install":[{"cmd":"npm install eslint-plugin-switch-case","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-switch-case","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-switch-case","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Plugin is typically used in ESLint config as a string reference, not imported directly. Use 'switch-case' in plugins array.","wrong":"const switchCase = require('eslint-plugin-switch-case')","symbol":"plugin","correct":"import switchCase from 'eslint-plugin-switch-case'"},{"note":"ESM-only since v4; CommonJS require may fail if package is not transpiled.","wrong":"const { rules } = require('eslint-plugin-switch-case')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-switch-case'"},{"note":"Configs are accessed via the configs export, not default import.","wrong":"import configs from 'eslint-plugin-switch-case/configs'","symbol":"configs","correct":"import { configs } from 'eslint-plugin-switch-case'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['switch-case'],\n  extends: ['plugin:switch-case/recommended'],\n  rules: {\n    'switch-case/no-case-curly': 'error',\n    'switch-case/newline-between-switch-case': ['error', 'always'],\n    'switch-case/no-default-case': 'error'\n  }\n};\n","lang":"javascript","description":"Sets up ESLint with the switch-case plugin using recommended config and custom rule overrides."},"warnings":[{"fix":"Upgrade ESLint to ^9.8.0 || ^10.0.0 and Node to ^20.19.0 || ^22.13.0 || >= 24.","message":"v4.0.0 drops support for ESLint <9.8.0 and Node <20.19.0.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use import statements or ensure your project is configured for ESM.","message":"v4.0.0 is ESM-only; CommonJS require('eslint-plugin-switch-case') may fail.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use import { rules, configs } from 'eslint-plugin-switch-case' instead of importing default.","message":"The plugin previously exported a default object; v4 uses named exports.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Manually select rules instead of extending recommended.","message":"The 'recommended' config enables all rules, which may be too strict for some projects.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-switch-case --save-dev' and add 'switch-case' to plugins.","cause":"ELSINT plugin not installed or misconfigured in plugins array.","error":"Cannot find module 'eslint-plugin-switch-case'"},{"fix":"Ensure plugins: ['switch-case'] is set in your ESLint config.","cause":"Plugin not specified in plugins array before using config.","error":"Failed to load config \"plugin:switch-case/recommended\""},{"fix":"Switch to ESM or use dynamic import().","cause":"Using require() to load the plugin in a CommonJS context with v4.0.0.","error":"ESLint configuration error: The \"switch-case\" plugin does not support CommonJS. Use import() or ensure your project is ESM."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}