{"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,"search_vec":"'10.0.0':42 '20.19.0':45 '22.13.0':46 '24':47 '4.0.0':34 '9.8.0':40 'activ':75 'case':4,11,19,22,29 'core':65 'cover':62 'cur':23 'current':30 'default':18 'destructur':83 'develop':76 'enforc':50 'eslint':1,6,39,64,78,80 'eslint-plugin':79 'eslintplugin':82 'fill':58 'includ':15 'javascript':77 'lint':13 'logic':53 'lukeapag':71 'maintain':69 'newlin':26 'newline-between-switch-cas':25 'nich':60 'no-case-cur':20 'no-default-cas':16 'node.js':44 'plugin':2,7,49,81 'provid':8 'releas':35 'rule':14,54,66 'specif':12 'stabl':31 'statement':57 'stylist':51 'support':37 'switch':3,10,28,56 'switch-case-specif':9 'version':32","created_at":"2026-04-25T11:20:33.359279+00:00","updated_at":"2026-04-25T11:20:33.359279+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/lukeapage/eslint-plugin-switch-case","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-switch-case","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}