File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
src/transforms/v2-to-v3/modules Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,6 @@ import type {
7
7
SpreadPropertyPattern ,
8
8
} from "jscodeshift" ;
9
9
10
- import { OBJECT_PROPERTY_TYPE_LIST } from "../config" ;
11
-
12
10
export type ObjectPatternProperty =
13
11
| Property
14
12
| PropertyPattern
@@ -21,14 +19,14 @@ export const objectPatternPropertyCompareFn = (
21
19
property1 : ObjectPatternProperty ,
22
20
property2 : ObjectPatternProperty
23
21
) => {
24
- if (
25
- OBJECT_PROPERTY_TYPE_LIST . includes ( property1 . type ) &&
26
- OBJECT_PROPERTY_TYPE_LIST . includes ( property2 . type )
27
- ) {
28
- const property1Key = ( property1 as Property | ObjectProperty ) . key ;
29
- const property2Key = ( property2 as Property | ObjectProperty ) . key ;
30
- if ( property1Key . type === "Identifier" && property2Key . type === "Identifier" )
31
- return property1Key . name . localeCompare ( property2Key . name ) ;
22
+ if ( property1 . type !== "Property" && property1 . type !== "ObjectProperty" ) {
23
+ return 0 ;
24
+ }
25
+ if ( property2 . type !== "Property" && property2 . type !== "ObjectProperty" ) {
26
+ return 0 ;
27
+ }
28
+ if ( property1 . key . type === "Identifier" && property2 . key . type === "Identifier" ) {
29
+ return property1 . key . name . localeCompare ( property2 . key . name ) ;
32
30
}
33
31
return 0 ;
34
32
} ;
You can’t perform that action at this time.
0 commit comments