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/rules/jsx-sort-props.md
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ Examples of **correct** code for this rule:
29
29
"callbacksLast":<boolean>,
30
30
"shorthandFirst":<boolean>,
31
31
"shorthandLast":<boolean>,
32
+
"multiline":"ignore"|"first"|"last",
32
33
"ignoreCase":<boolean>,
33
34
"noSortAlphabetically":<boolean>,
34
35
"reservedFirst":<boolean>|<array<string>>,
@@ -70,6 +71,42 @@ When `true`, short hand props must be listed after all other props (unless `call
70
71
<Hello name="John" tel={5555555} active validate />
71
72
```
72
73
74
+
### `multiline`
75
+
76
+
Enforced sorting for multiline props
77
+
78
+
*`ignore`: Multiline props will not be taken in consideration for sorting.
79
+
80
+
*`first`: Multiline props must be listed before all other props (unless `shorthandFirst` is set), but still respecting the alphabetical order.
81
+
82
+
*`last`: Multiline props must be listed after all other props (unless either `callbacksLast` or `shorthandLast` are set), but still respecting the alphabetical order.
83
+
84
+
Defaults to `ignore`.
85
+
86
+
```jsx
87
+
// 'jsx-sort-props': [1, { multiline: 'first' }]
88
+
<Hello
89
+
classes={{
90
+
greetings:classes.greetings,
91
+
}}
92
+
active
93
+
validate
94
+
name="John"
95
+
tel={5555555}
96
+
/>
97
+
98
+
// 'jsx-sort-props': [1, { multiline: 'last' }]
99
+
<Hello
100
+
active
101
+
validate
102
+
name="John"
103
+
tel={5555555}
104
+
classes={{
105
+
greetings:classes.greetings,
106
+
}}
107
+
/>
108
+
```
109
+
73
110
### `noSortAlphabetically`
74
111
75
112
When `true`, alphabetical order is **not** enforced:
0 commit comments