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
+29-2Lines changed: 29 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ This rule checks all JSX components and verifies that all props are sorted alpha
15
15
Examples of **incorrect** code for this rule:
16
16
17
17
```jsx
18
-
<Hello lastName="Smith" firstName="John"/>;
18
+
<Hello lastName="Smith" firstName="John"/>
19
19
```
20
20
21
21
Examples of **correct** code for this rule:
@@ -37,6 +37,7 @@ Examples of **correct** code for this rule:
37
37
"ignoreCase":<boolean>,
38
38
"noSortAlphabetically":<boolean>,
39
39
"reservedFirst":<boolean>|<array<string>>,
40
+
"sortFirst":<array<string>>,
40
41
"locale":"auto"|"any valid locale"
41
42
}]
42
43
...
@@ -49,7 +50,7 @@ When `true` the rule ignores the case-sensitivity of the props order.
49
50
Examples of **correct** code for this rule
50
51
51
52
```jsx
52
-
<Hello name="John"Number="2"/>;
53
+
<Hello name="John"Number="2"/>
53
54
```
54
55
55
56
### `callbacksLast`
@@ -140,6 +141,32 @@ With `reservedFirst: ["key"]`, the following will **not** warn:
140
141
<Hello key={'uuid'} name="John" ref={johnRef} />
141
142
```
142
143
144
+
### `sortFirst`
145
+
146
+
When `sortFirst` is defined as an array of prop names, those props must be listed before all other props, maintaining the exact order specified in the array. This option has the highest priority and takes precedence over all other sorting options (including `reservedFirst`, `shorthandFirst`, `callbacksLast`, and `multiline`).
147
+
148
+
The prop names in the array are matched case-sensitively by default, but respect the `ignoreCase` option when enabled.
0 commit comments