# default-case

Require a `default` branch in `switch` statements.

**Deprecated**

- **Lifecycle:** Deprecated, frozen, and non-recommended.
- **Deprecated since:** `v3.0.0`
- **Available until:** `v4.0.0`
- **Use instead:** ESLint core [`default-case`](https://eslint.org/docs/latest/rules/default-case)

This rule is a direct runtime proxy of the core rule and adds no independent
analysis. Migrate the options unchanged to the core rule ID.

## Targeted pattern scope

This rule targets all JavaScript and TypeScript `switch` statements.

## What this rule reports

This rule reports `switch` statements that do not include a `default` case.

## Why this rule exists

Missing defaults can silently ignore unexpected values and create fragile
control flow.

## ❌ Incorrect

```ts
switch (status) {
 case "open":
  break;
}
```

## ✅ Correct

```ts
switch (status) {
 case "open":
  break;
 default:
  break;
}
```

## Behavior and migration notes

This rule forwards options and behavior to ESLint core `default-case`.

## Additional examples

```ts
switch (kind) {
 case "a":
  runA();
  break;
}
// ❌ reported

switch (kind) {
 case "a":
  runA();
  break;
 default:
  throw new Error(`Unhandled kind: ${kind}`);
}
// ✅ valid
```

## ESLint flat config example

```ts
import etcMisc from "eslint-plugin-etc-misc";

export default [
 {
  plugins: { "etc-misc": etcMisc },
  rules: {
   "etc-misc/default-case": "error",
  },
 },
];
```

## When not to use it

Disable this rule if you enforce exhaustive unions with explicit `never`
checks and intentionally avoid `default` branches.

## Package documentation

- [eslint-plugin-etc-misc README](https://github.com/Nick2bad4u/eslint-plugin-etc-misc#readme)

> **Rule catalog ID:** R013

## Further reading

- [ESLint: `default-case`](https://eslint.org/docs/latest/rules/default-case)

## Adoption resources

- Start at warning level in CI, then move to error after cleanup.
- Use focused codemods/autofix batches per package or directory.
