Skip to content

Commit f639d94

Browse files
authored
feat: add fallback sort option to all rules
1 parent b0a54df commit f639d94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2109
-32
lines changed

docs/content/rules/sort-array-includes.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ Determines whether the sorted items should be in ascending or descending order.
140140
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
141141
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
142142

143+
### fallbackSort
144+
145+
<sub>
146+
type: `{ type: string; order?: 'asc' | 'desc' }`
147+
</sub>
148+
<sub>default: `{ type: 'unsorted' }`</sub>
149+
150+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
151+
[`type`](#type).
152+
153+
Example: enforce alphabetical sort between two elements with the same length.
154+
```ts
155+
{
156+
type: 'line-length',
157+
order: 'desc'
158+
fallbackSort: { type: 'alphabetical', order: 'asc' }
159+
}
160+
```
161+
143162
### alphabet
144163

145164
<sub>default: `''`</sub>

docs/content/rules/sort-classes.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,25 @@ Determines whether the sorted items should be in ascending or descending order.
174174
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
175175
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
176176

177+
### fallbackSort
178+
179+
<sub>
180+
type: `{ type: string; order?: 'asc' | 'desc' }`
181+
</sub>
182+
<sub>default: `{ type: 'unsorted' }`</sub>
183+
184+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
185+
[`type`](#type).
186+
187+
Example: enforce alphabetical sort between two elements with the same length.
188+
```ts
189+
{
190+
type: 'line-length',
191+
order: 'desc'
192+
fallbackSort: { type: 'alphabetical', order: 'asc' }
193+
}
194+
```
195+
177196
### alphabet
178197

179198
<sub>default: `''`</sub>

docs/content/rules/sort-decorators.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,25 @@ Determines whether the sorted items should be in ascending or descending order.
138138
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
139139
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
140140

141+
### fallbackSort
142+
143+
<sub>
144+
type: `{ type: string; order?: 'asc' | 'desc' }`
145+
</sub>
146+
<sub>default: `{ type: 'unsorted' }`</sub>
147+
148+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
149+
[`type`](#type).
150+
151+
Example: enforce alphabetical sort between two elements with the same length.
152+
```ts
153+
{
154+
type: 'line-length',
155+
order: 'desc'
156+
fallbackSort: { type: 'alphabetical', order: 'asc' }
157+
}
158+
```
159+
141160
### alphabet
142161

143162
<sub>default: `''`</sub>

docs/content/rules/sort-enums.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@ Determines whether the sorted items should be in ascending or descending order.
104104
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
105105
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
106106

107+
### fallbackSort
108+
109+
<sub>
110+
type: `{ type: string; order?: 'asc' | 'desc' }`
111+
</sub>
112+
<sub>default: `{ type: 'unsorted' }`</sub>
113+
114+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
115+
[`type`](#type).
116+
117+
Example: enforce alphabetical sort between two elements with the same length.
118+
```ts
119+
{
120+
type: 'line-length',
121+
order: 'desc'
122+
fallbackSort: { type: 'alphabetical', order: 'asc' }
123+
}
124+
```
125+
107126
### alphabet
108127

109128
<sub>default: `''`</sub>

docs/content/rules/sort-exports.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@ Determines whether the sorted items should be in ascending or descending order.
9898
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
9999
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
100100

101+
### fallbackSort
102+
103+
<sub>
104+
type: `{ type: string; order?: 'asc' | 'desc' }`
105+
</sub>
106+
<sub>default: `{ type: 'unsorted' }`</sub>
107+
108+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
109+
[`type`](#type).
110+
111+
Example: enforce alphabetical sort between two elements with the same length.
112+
```ts
113+
{
114+
type: 'line-length',
115+
order: 'desc'
116+
fallbackSort: { type: 'alphabetical', order: 'asc' }
117+
}
118+
```
119+
101120
### alphabet
102121

103122
<sub>default: `''`</sub>

docs/content/rules/sort-heritage-clauses.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,25 @@ Determines whether the sorted items should be in ascending or descending order.
8181
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
8282
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
8383

84+
### fallbackSort
85+
86+
<sub>
87+
type: `{ type: string; order?: 'asc' | 'desc' }`
88+
</sub>
89+
<sub>default: `{ type: 'unsorted' }`</sub>
90+
91+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
92+
[`type`](#type).
93+
94+
Example: enforce alphabetical sort between two elements with the same length.
95+
```ts
96+
{
97+
type: 'line-length',
98+
order: 'desc'
99+
fallbackSort: { type: 'alphabetical', order: 'asc' }
100+
}
101+
```
102+
84103
### alphabet
85104

86105
<sub>default: `''`</sub>

docs/content/rules/sort-imports.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,25 @@ Determines whether the sorted items should be in ascending or descending order.
137137
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
138138
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
139139

140+
### fallbackSort
141+
142+
<sub>
143+
type: `{ type: string; order?: 'asc' | 'desc' }`
144+
</sub>
145+
<sub>default: `{ type: 'unsorted' }`</sub>
146+
147+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
148+
[`type`](#type).
149+
150+
Example: enforce alphabetical sort between two elements with the same length.
151+
```ts
152+
{
153+
type: 'line-length',
154+
order: 'desc'
155+
fallbackSort: { type: 'alphabetical', order: 'asc' }
156+
}
157+
```
158+
140159
### alphabet
141160

142161
<sub>default: `''`</sub>

docs/content/rules/sort-interfaces.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,25 @@ Determines whether the sorted items should be in ascending or descending order.
154154
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
155155
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
156156

157+
### fallbackSort
158+
159+
<sub>
160+
type: `{ type: string; order?: 'asc' | 'desc' }`
161+
</sub>
162+
<sub>default: `{ type: 'unsorted' }`</sub>
163+
164+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
165+
[`type`](#type).
166+
167+
Example: enforce alphabetical sort between two elements with the same length.
168+
```ts
169+
{
170+
type: 'line-length',
171+
order: 'desc'
172+
fallbackSort: { type: 'alphabetical', order: 'asc' }
173+
}
174+
```
175+
157176
### alphabet
158177

159178
<sub>default: `''`</sub>

docs/content/rules/sort-intersection-types.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,25 @@ Determines whether the sorted items should be in ascending or descending order.
9494
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
9595
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
9696

97+
### fallbackSort
98+
99+
<sub>
100+
type: `{ type: string; order?: 'asc' | 'desc' }`
101+
</sub>
102+
<sub>default: `{ type: 'unsorted' }`</sub>
103+
104+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
105+
[`type`](#type).
106+
107+
Example: enforce alphabetical sort between two elements with the same length.
108+
```ts
109+
{
110+
type: 'line-length',
111+
order: 'desc'
112+
fallbackSort: { type: 'alphabetical', order: 'asc' }
113+
}
114+
```
115+
97116
### alphabet
98117

99118
<sub>default: `''`</sub>

docs/content/rules/sort-jsx-props.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,25 @@ Determines whether the sorted items should be in ascending or descending order.
154154
- `'asc'` — Sort items in ascending order (A to Z, 1 to 9).
155155
- `'desc'` — Sort items in descending order (Z to A, 9 to 1).
156156

157+
### fallbackSort
158+
159+
<sub>
160+
type: `{ type: string; order?: 'asc' | 'desc' }`
161+
</sub>
162+
<sub>default: `{ type: 'unsorted' }`</sub>
163+
164+
Defines a list of fallback sort options to use when comparing two elements that are equal according to the primary sort
165+
[`type`](#type).
166+
167+
Example: enforce alphabetical sort between two elements with the same length.
168+
```ts
169+
{
170+
type: 'line-length',
171+
order: 'desc'
172+
fallbackSort: { type: 'alphabetical', order: 'asc' }
173+
}
174+
```
175+
157176
### alphabet
158177

159178
<sub>default: `''`</sub>

0 commit comments

Comments
 (0)