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-jsx-props.mdx
+29
Original file line number
Diff line number
Diff line change
@@ -200,6 +200,12 @@ Allows you to specify names or patterns for JSX elements that should be ignored
200
200
201
201
You can specify their names or a regexp pattern to ignore, for example: `'^Table.+'` to ignore all object types whose names begin with the word Table.
202
202
203
+
### partitionByNewLine
204
+
205
+
<sub>default: `false`</sub>
206
+
207
+
When `true`, the rule will not sort members if there is an empty line between them. This can be useful for keeping logically separated groups of members in their defined order.
208
+
203
209
### groups
204
210
205
211
<sub>
@@ -225,6 +231,25 @@ Within a given group, members will be sorted according to the `type`, `order`, `
225
231
Individual groups can be combined together by placing them in an array. The order of groups in that array does not matter.
226
232
All members of the groups in the array will be sorted together as if they were part of a single group.
227
233
234
+
#### Newlines between groups
235
+
236
+
You may place `newlinesBetween` objects between your groups to enforce the newline behavior between two specific groups.
237
+
238
+
See the [`newlinesBetween`](#newlinesbetween) option.
239
+
240
+
This feature is only applicable when `partitionByNewLine` is false.
241
+
242
+
```ts
243
+
{
244
+
newlinesBetween: 'always',
245
+
groups: [
246
+
'a',
247
+
{ newlinesBetween: 'never' }, // Overrides the global newlinesBetween option
248
+
'b',
249
+
]
250
+
}
251
+
```
252
+
228
253
### customGroups
229
254
230
255
<sub>
@@ -280,6 +305,8 @@ Custom group matching takes precedence over predefined group matching.
280
305
ignoreCase: true,
281
306
specialCharacters: 'keep',
282
307
ignorePattern: [],
308
+
partitionByNewLine: false,
309
+
newlinesBetween: 'ignore',
283
310
groups: [],
284
311
customGroups: {},
285
312
},
@@ -307,6 +334,8 @@ Custom group matching takes precedence over predefined group matching.
0 commit comments