Skip to content

Commit 57ce99c

Browse files
authored
docs: improve documentation of groups usage
1 parent 5583eb0 commit 57ce99c

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

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

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ Predefined Groups:
144144
- `'tuple`' — Tuple types.
145145
- `'union`' — Union types.
146146
- `'nullish`' — Nullish types (`null` or `undefined`).
147-
- `'unknown`' — Types that don’t fit into any other group.
147+
- `'unknown`' — Types that don’t fit into any group entered by the user.
148148

149-
Example:
149+
Example using all predefined groups:
150150

151151
```ts
152152
type Example =
@@ -178,7 +178,49 @@ type Example =
178178
| null
179179
| undefined;
180180
```
181+
Groups configuration:
181182

183+
```
184+
groups: [
185+
'conditional',
186+
'function',
187+
'import',
188+
'intersection',
189+
'keyword',
190+
'literal',
191+
'named',
192+
'object',
193+
'operator',
194+
'tuple',
195+
'union',
196+
'nullish',
197+
],
198+
```
199+
200+
Example 2:
201+
202+
Combine and sort `intersection` and `union` groups together:
203+
204+
```ts
205+
type Example =
206+
| AnotherType
207+
| SomeType
208+
| (A & B)
209+
| (A | B)
210+
| (C & D)
211+
| (C | D)
212+
| keyof T;
213+
```
214+
215+
Groups configuration:
216+
217+
```
218+
groups: [
219+
'named',
220+
['intersection', 'union'],
221+
'unknown',
222+
],
223+
```
182224

183225
## Usage
184226

0 commit comments

Comments
 (0)