-
-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Clear and concise description of the problem
Hey there, I'm back with another suggestion: /// keep-sorted for switch statements. The idea comes from this file
Suggested solution
Basic
/// keep-sorted
switch (x) {
case "b":
doB();
break
case "a":
doA();
break;
}
// ->
/// keep-sorted
switch (x) {
case "a":
doA();
break
case "b":
doB();
break;
}Complex/weird
/// keep-sorted
switch (x) {
case "fallback":
falling();
case "c":
case "b":
common();
break;
case "d":
case "a":
aOrD();
break;
}
// ->
/// keep-sorted
switch (x) {
case "a": // `a` comes before `fallback`
case "d":
aOrD();
break;
case "fallback":
falling();
case "b":
case "c":
common();
break;
}Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request