eslint-plugin-misc

ESLint plugin

This project is maintained by iliubinskii

typescript/exhaustive-switch

ESLint plugin / typescript/exhaustive-switch

Checks exhaustiveness of switch statement.

module.exports = {
  plugins: ["misc"],
  rules: {
    "misc/typescript/exhaustive-switch": "error"
  }
};

Examples of incorrect code

function f(x: 1 | 2): void {
  switch (x) {
    case 1:
  }
}

Examples of correct code

function f(x: 1 | 2): void {
  switch (x) {
    case 1:
    case 2:
  }
}