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
@@ -145,6 +145,41 @@ Specifies the sorting locales. Refer To [String.prototype.localeCompare() - loca
145
145
-`string` — A BCP 47 language tag (e.g. `'en'`, `'en-US'`, `'zh-CN'`).
146
146
-`string[]` — An array of BCP 47 language tags.
147
147
148
+
### partitionByComment
149
+
150
+
<sub>default: `false`</sub>
151
+
152
+
Enables the use of comments to separate class decorators into logical groups.
153
+
154
+
-`true` — All comments will be treated as delimiters, creating partitions.
155
+
-`false` — Comments will not be used as delimiters.
156
+
-`RegExpPattern = string | { pattern: string; flags: string}` — A regexp pattern to specify which comments should act as delimiters.
157
+
-`RegExpPattern[]` — A list of regexp patterns to specify which comments should act as delimiters.
158
+
-`{ block: boolean | RegExpPattern | RegExpPattern[]; line: boolean | RegExpPattern | RegExpPattern[] }` — Specify which block and line comments should act as delimiters.
159
+
160
+
### partitionByNewLine
161
+
162
+
<sub>default: `false`</sub>
163
+
164
+
When `true`, the rule will not sort the heritage clauses if there is an empty line between them.
165
+
166
+
### newlinesBetween
167
+
168
+
<sub>type: `number | 'ignore'`</sub>
169
+
<sub>default: `'ignore'`</sub>
170
+
171
+
Specifies how to handle newlines between groups.
172
+
173
+
-`'ignore'` — Do not report errors related to newlines.
174
+
-`0` — No newlines are allowed.
175
+
- Any other number — Enforce this number of newlines between each group, and forbid newlines inside groups.
176
+
177
+
You can also enforce the newline behavior between two specific groups through the `groups` options.
178
+
179
+
See the [`groups`](#newlines-between-groups) option.
180
+
181
+
This option is only applicable when [`partitionByNewLine`](#partitionbynewline) is `false`.
182
+
148
183
### groups
149
184
150
185
<sub>
@@ -168,21 +203,110 @@ Within a given group, members will be sorted according to the `type`, `order`, `
168
203
Individual groups can be combined together by placing them in an array. The order of groups in that array does not matter.
169
204
All members of the groups in the array will be sorted together as if they were part of a single group.
170
205
206
+
#### Newlines between groups
207
+
208
+
You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups.
209
+
210
+
See the [`newlinesBetween`](#newlinesbetween) option.
211
+
212
+
This feature is only applicable when [`partitionByNewLine`](#partitionbynewline) is `false`.
213
+
214
+
```ts
215
+
{
216
+
newlinesBetween: 1,
217
+
groups: [
218
+
'a',
219
+
{ newlinesBetween: 0 }, // Overrides the global newlinesBetween option
220
+
'b',
221
+
]
222
+
}
223
+
```
224
+
171
225
### customGroups
172
226
227
+
<Importanttitle="Migrating from the old API">
228
+
Support for the object-based `customGroups` option has been removed.
229
+
230
+
Migrating from the old to the current API is easy:
Copy file name to clipboardExpand all lines: docs/content/rules/sort-intersection-types.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: sort-intersection-types
3
-
description: ESEnsure intersection types in TypeScript are sorted for cleaner and more maintainable code. This ESLint rule promotes a standardized ordering of intersection types
3
+
description: Ensure intersection types in TypeScript are sorted for cleaner and more maintainable code. This ESLint rule promotes a standardized ordering of intersection types
0 commit comments