Only two cases does not cause error

Make sure to read this post before raising a thread here:

Then tell us:

  • What language is this for? TypeScript

  • Which rule? ‘no-small-switch’

  • Why do you believe it’s a false-positive/false-negative? The rule states that switch statements should have at least 3 “case” clauses. The code only throws an error if I have 1 case statement, or 1 case and a default. If the default clause is counted as a case statement, it does not correctly account for when no case statement exists, because I have 2 case statements and no default, but the error does not occur (maybe due to an “implicit” default?).

  • Are you using

  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)

The following does not error, although I would expect it to:

switch (Position) {
	case 1: {
		return Color3.fromRGB(255, 198, 171);
	}
	case 2: {
		return Color3.fromRGB(255, 255, 255);
	}
}

Hello Christopher,

Thank you for reporting this issue. We will update the documentation to match the rule’s behaviour.

Here is the ticket to track this.