You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/rules/sort-named-exports.mdx
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ Specifies the sorting method.
107
107
-`'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
108
108
-`'line-length'` — Sort items by the length of the code line (shorter lines first).
109
109
-`'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
110
-
-`'unsorted'` — Do not sort items.
110
+
-`'unsorted'` — Do not sort items.[`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.
111
111
112
112
### order
113
113
@@ -242,6 +242,22 @@ export {
242
242
243
243
Each group of members (separated by empty lines) is treated independently, and the order within each group is preserved.
244
244
245
+
### newlinesBetween
246
+
247
+
<sub>default: `'ignore'`</sub>
248
+
249
+
Specifies how new lines should be handled between groups.
250
+
251
+
-`ignore` — Do not report errors related to new lines.
252
+
-`always` — Enforce one new line between each group, and forbid new lines inside a group.
253
+
-`never` — No new lines are allowed.
254
+
255
+
You can also enforce the newline behavior between two specific groups through the `groups` options.
256
+
257
+
See the [`groups`](#newlines-between-groups) option.
258
+
259
+
This option is only applicable when `partitionByNewLine` is `false`.
260
+
245
261
### groups
246
262
247
263
<sub>
@@ -279,6 +295,25 @@ Example: `type-export`.
279
295
Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option,
280
296
it will automatically be added to the end of the list.
281
297
298
+
##### Newlines between groups
299
+
300
+
You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups.
301
+
302
+
See the [`newlinesBetween`](#newlinesbetween) option.
303
+
304
+
This feature is only applicable when `partitionByNewLine` is false.
305
+
306
+
```ts
307
+
{
308
+
newlinesBetween: 'always',
309
+
groups: [
310
+
'a',
311
+
{ newlinesBetween: 'never' }, // Overrides the global newlinesBetween option
312
+
'b',
313
+
]
314
+
}
315
+
```
316
+
282
317
### customGroups
283
318
284
319
<sub>
@@ -366,6 +401,7 @@ Custom groups have a higher priority than any predefined group.
366
401
groupKind: 'mixed',
367
402
partitionByNewLine: false,
368
403
partitionByComment: false,
404
+
newlinesBetween: 'ignore',
369
405
groups: [],
370
406
customGroups: [],
371
407
},
@@ -397,6 +433,7 @@ Custom groups have a higher priority than any predefined group.
Copy file name to clipboardExpand all lines: docs/content/rules/sort-named-imports.mdx
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,7 @@ Specifies the sorting method.
108
108
-`'natural'` — Sort items in a [natural](https://github.com/yobacca/natural-orderby) order (e.g., “item2” < “item10”).
109
109
-`'line-length'` — Sort items by the length of the code line (shorter lines first).
110
110
-`'custom'` — Sort items using the alphabet entered in the [`alphabet`](#alphabet) option.
111
-
-`'unsorted'` — Do not sort items.
111
+
-`'unsorted'` — Do not sort items.[`grouping`](#groups) and [`newlines behavior`](#newlinesbetween) are still enforced.
112
112
113
113
### order
114
114
@@ -241,6 +241,22 @@ import {
241
241
} from'./devices'
242
242
```
243
243
244
+
### newlinesBetween
245
+
246
+
<sub>default: `'ignore'`</sub>
247
+
248
+
Specifies how new lines should be handled between groups.
249
+
250
+
-`ignore` — Do not report errors related to new lines.
251
+
-`always` — Enforce one new line between each group, and forbid new lines inside a group.
252
+
-`never` — No new lines are allowed.
253
+
254
+
You can also enforce the newline behavior between two specific groups through the `groups` options.
255
+
256
+
See the [`groups`](#newlines-between-groups) option.
257
+
258
+
This option is only applicable when `partitionByNewLine` is `false`.
259
+
244
260
### groups
245
261
246
262
<sub>
@@ -278,6 +294,25 @@ Example: `type-import`.
278
294
Members that don’t fit into any group specified in the `groups` option will be placed in the `unknown` group. If the `unknown` group is not specified in the `groups` option,
279
295
it will automatically be added to the end of the list.
280
296
297
+
##### Newlines between groups
298
+
299
+
You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups.
300
+
301
+
See the [`newlinesBetween`](#newlinesbetween) option.
302
+
303
+
This feature is only applicable when `partitionByNewLine` is false.
304
+
305
+
```ts
306
+
{
307
+
newlinesBetween: 'always',
308
+
groups: [
309
+
'a',
310
+
{ newlinesBetween: 'never' }, // Overrides the global newlinesBetween option
311
+
'b',
312
+
]
313
+
}
314
+
```
315
+
281
316
### customGroups
282
317
283
318
<sub>
@@ -365,6 +400,7 @@ Custom groups have a higher priority than any predefined group.
365
400
groupKind: 'mixed',
366
401
partitionByNewLine: false,
367
402
partitionByComment: false,
403
+
newlinesBetween: 'ignore',
368
404
groups: [],
369
405
customGroups: [],
370
406
},
@@ -396,6 +432,7 @@ Custom groups have a higher priority than any predefined group.
0 commit comments