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/sort-prop-types.md
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,7 @@ class Component extends React.Component {
80
80
"callbacksLast":<boolean>,
81
81
"ignoreCase":<boolean>,
82
82
"requiredFirst":<boolean>,
83
+
"sortShapeProp":<boolean>
83
84
}]
84
85
...
85
86
```
@@ -120,6 +121,25 @@ var Component = createReactClass({
120
121
});
121
122
```
122
123
124
+
### `sortShapeProp`
125
+
126
+
When `true`, props defined in `PropTypes.shape` must be sorted via the same rules as the top-level props:
127
+
128
+
```js
129
+
var Component =createReactClass({
130
+
propTypes: {
131
+
a:PropTypes.number,
132
+
b:PropTypes.shape({
133
+
d:PropTypes.number,
134
+
e:PropTypes.func,
135
+
f:PropTypes.bool,
136
+
}),
137
+
c:PropTypes.string,
138
+
},
139
+
...
140
+
});
141
+
```
142
+
123
143
## When not to use
124
144
125
145
This rule is a formatting preference and not following it won't negatively affect the quality of your code. If alphabetizing props declarations isn't a part of your coding standards, then you can leave this rule off.
0 commit comments