# eslint-plugin-switch-case

> switch-case specific linting rules for ESLint

Latest version **4.0.0** (published 2026-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-switch-case
pnpm add eslint-plugin-switch-case
yarn add eslint-plugin-switch-case
bun add eslint-plugin-switch-case
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-03-22 |
| First published | 2016-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^20.19.0 \|\| ^22.13.0 \|\| >= 24 |
| Dependencies | 0 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Luke Page |
| Maintainers | lukeapage |
| Keywords | eslint, eslint-plugin, eslintplugin, destructuring |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-switch-case
- Repository: https://github.com/lukeapage/eslint-plugin-switch-case
- Issues: https://github.com/lukeapage/eslint-plugin-switch-case/issues
- npm.io page: https://npm.io/package/eslint-plugin-switch-case

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2026-03-22
- 3.0.1 — 2024-08-02
- 3.0.0 — 2024-08-02
- 1.1.2 — 2016-08-01
- 1.1.1 — 2016-07-23
- 1.1.0 — 2016-07-17
- 1.0.1 — 2016-07-17
- 1.0.0 — 2016-07-17
- 0.0.1 — 2016-07-17

## README

# ESLint-Plugin-Switch-Case

[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]

Switch-case-specific linting rules for ESLint.

# Installation

Install [ESLint](https://www.github.com/eslint/eslint) either locally or globally.

    $ npm install eslint

If you installed `ESLint` globally, you have to install the plugin globally too. Otherwise, install it locally.

    $ npm install eslint-plugin-switch-case

# Configuration

Add a `plugins` section and specify eslint-plugin-switch-case as a plugin.

Then, enable all of the rules that you would like to use.

## Recommended configuration

This plugin exports a `recommended` configuration that enforces all the rules. You can configure the plugin as follows:

```json
{
  "plugins": ["switch-case"],
  "extends": ["plugin:switch-case/recommended"]
}
```

# List of provided rules

Rules are divided into categories for your convenience. All rules are off by default, unless you use one of the plugin's configurations which turn all relevant rules on.

### Possible Errors

These rules relate to possible logic errors in code.

- [no-default-case](docs/rules/no-default-case.md): Disallow default case in switch statements.

### Stylistic Issues

These rules are purely matters of style and are quite subjective.

- [no-case-curly](docs/rules/no-case-curly.md): Forbid curly brackets around case statements.
- [newline-between-switch-case](docs/rules/newline-between-switch-case.md): Configure newlines around switch cases.

# Contributing

Contributions are always welcome!.

# License

eslint-plugin-switch-case is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php).

[npm-url]: https://npmjs.org/package/eslint-plugin-switch-case
[npm-image]: http://img.shields.io/npm/v/eslint-plugin-switch-case.svg?style=flat-square
[travis-url]: https://travis-ci.org/lukeapage/eslint-plugin-switch-case
[travis-image]: http://img.shields.io/travis/lukeapage/eslint-plugin-switch-case/master.svg?style=flat-square
[deps-url]: https://david-dm.org/lukeapage/eslint-plugin-switch-case
[deps-image]: https://img.shields.io/david/dev/lukeapage/eslint-plugin-switch-case.svg?style=flat-square
[status-url]: https://github.com/lukeapage/eslint-plugin-switch-case/pulse
[status-image]: http://img.shields.io/badge/status-maintained-brightgreen.svg?style=flat-square

---
_Source: https://npm.io/package/eslint-plugin-switch-case · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
