|
2 | 2 |
|
3 | 3 | --- |
4 | 4 |
|
5 | | -# require string-enum members to be sorted (string-enum) |
| 5 | +# require string enum members to be sorted (string-enum) |
6 | 6 |
|
7 | | -When declaring multiple members on a string-enum, some developers prefer to sort string-enum member names alphabetically to be able to find necessary members easier at the later time. Others feel that it adds complexity and becomes burden to maintain. |
| 7 | +When declaring multiple members on a string enum, some developers prefer to sort string enum member names alphabetically to be able to find necessary members easier at the later time. Others feel that it adds complexity and becomes burden to maintain. |
8 | 8 |
|
9 | 9 | ## Rule Details |
10 | 10 |
|
11 | | -This rule checks all members of a string-enum declaration and verifies that all keys are sorted alphabetically. |
| 11 | +This rule checks all members of a string enum declaration and verifies that all keys are sorted alphabetically. |
12 | 12 |
|
13 | 13 | Examples of **incorrect** code for this rule: |
14 | 14 |
|
@@ -81,13 +81,13 @@ enum U { |
81 | 81 |
|
82 | 82 | The 1st option is `"asc"` or `"desc"`. |
83 | 83 |
|
84 | | -- `"asc"` (default) - enforce string-enum members to be in ascending order. |
85 | | -- `"desc"` - enforce string-enum members to be in descending order. |
| 84 | +- `"asc"` (default) - enforce string enum members to be in ascending order. |
| 85 | +- `"desc"` - enforce string enum members to be in descending order. |
86 | 86 |
|
87 | 87 | The 2nd option is an object which has 2 properties. |
88 | 88 |
|
89 | | -- `caseSensitive` - if `true`, enforce string-enum members to be in case-sensitive order. Default is `true`. |
90 | | -- `natural` - if `true`, enforce string-enum members to be in natural order. Default is `false`. Natural Order compares strings containing combination of letters and numbers in the way a human being would sort. It basically sorts numerically, instead of sorting alphabetically. So the number 10 comes after the number 3 in Natural Sorting. |
| 89 | +- `caseSensitive` - if `true`, enforce string enum members to be in case-sensitive order. Default is `true`. |
| 90 | +- `natural` - if `true`, enforce string enum members to be in natural order. Default is `false`. Natural Order compares strings containing combination of letters and numbers in the way a human being would sort. It basically sorts numerically, instead of sorting alphabetically. So the number 10 comes after the number 3 in Natural Sorting. |
91 | 91 |
|
92 | 92 | ### desc |
93 | 93 |
|
@@ -209,4 +209,4 @@ enum U { |
209 | 209 |
|
210 | 210 | ## When Not To Use It |
211 | 211 |
|
212 | | -If you don't want to notify about string-enum members' order, then it's safe to disable this rule. |
| 212 | +If you don't want to notify about string enum members' order, then it's safe to disable this rule. |
0 commit comments