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-imports.mdx
+30
Original file line number
Diff line number
Diff line change
@@ -183,6 +183,30 @@ Specifies whether side effect imports should be sorted. By default, sorting side
183
183
-`true` — Sort side effect imports.
184
184
-`false` — Do not sort side effect imports.
185
185
186
+
### partitionByComment
187
+
188
+
<sub>default: `false`</sub>
189
+
190
+
Allows you to use comments to separate imports into logical groups.
191
+
192
+
-`true` — All comments will be treated as delimiters, creating partitions.
193
+
-`false` — Comments will not be used as delimiters.
194
+
-`string` — A regexp pattern to specify which comments should act as delimiters.
195
+
-`string[]` — An array of regexp patterns to specify which comments should act as delimiters.
196
+
197
+
### partitionByNewLine
198
+
199
+
<sub>default: `false`</sub>
200
+
201
+
When `true`, the rule will not sort imports if there is an empty line between them. This can be useful for keeping logically separated groups of members in their defined order.
202
+
203
+
```ts
204
+
import { b1, b2 } from'b'
205
+
206
+
import { a } from'a'
207
+
import { c } from'c'
208
+
```
209
+
186
210
### newlinesBetween
187
211
188
212
<sub>default: `'always'`</sub>
@@ -193,6 +217,8 @@ Specifies how new lines should be handled between import groups.
193
217
-`always` — Enforce one new line between each group, and forbid new lines inside a group.
194
218
-`never` — No new lines are allowed in the entire import section.
195
219
220
+
This options is only applicable when `partitionByNewLine` is `false`.
221
+
196
222
### maxLineLength
197
223
198
224
<sub>default: `undefined`</sub>
@@ -375,6 +401,8 @@ Specifies which environment’s built-in modules should be recognized. If you ar
375
401
ignoreCase: true,
376
402
specialCharacters: 'keep',
377
403
internalPattern: ['^~/.+'],
404
+
partitionByComment: false,
405
+
partitionByNewLine: false,
378
406
newlinesBetween: 'always',
379
407
maxLineLength: undefined,
380
408
groups: [
@@ -414,6 +442,8 @@ Specifies which environment’s built-in modules should be recognized. If you ar
0 commit comments