Like SA1413 where a trailing comma is required in multi-line initializes, I propose a rule where a trailing comma is required in a multi-line switch statement, for the same reason SA1413 was introduced:
string str = "hello";
string str2 = str switch
{
"hello" => "hello",
"goodbye" => "bye bye", // No warning.
};
string str3 = str switch
{
"hello" => "hello",
"goodbye" => "goodbye" // Warning: use trailing comma in multi-line switch statement.
};
SA1413 itself should be updated to cover this case.
Most helpful comment
SA1413 itself should be updated to cover this case.