We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bfe9a9f commit 3853463Copy full SHA for 3853463
src/formatter/propNameSorter.js
@@ -1,13 +1,17 @@
1
/* @flow */
2
3
+const isKeyOrRefProps = (propName: string) => ['key', 'ref'].includes(propName);
4
+
5
export default (sortProps: boolean) => (a: string, b: string): -1 | 0 | 1 => {
6
if (a === b) {
7
return 0;
8
}
9
- if (['key', 'ref'].includes(a)) {
10
+ if (isKeyOrRefProps(a) && isKeyOrRefProps(b)) {
11
+ return 1;
12
+ } else if (isKeyOrRefProps(a)) {
13
return -1;
- } else if (['key', 'ref'].includes(b)) {
14
+ } else if (isKeyOrRefProps(b)) {
15
return 1;
16
17
0 commit comments