File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -87,21 +87,12 @@ export function factory({ configSet }: TsCompilerInstance) {
87
87
return statements
88
88
}
89
89
90
- const pivot = statements [ 0 ]
91
- const leftPart : _ts . Statement [ ] = [ ]
92
- const rightPart : _ts . Statement [ ] = [ ]
93
- for ( let i = 1 ; i < statements . length ; i ++ ) {
94
- const currentStatement = statements [ i ]
95
- if ( isJestGlobalImport ( currentStatement ) ) {
96
- leftPart . push ( currentStatement )
97
- } else {
98
- isHoistableStatement ( currentStatement ) && ! isHoistableStatement ( pivot ) && ! isJestGlobalImport ( pivot )
99
- ? leftPart . push ( currentStatement )
100
- : rightPart . push ( currentStatement )
101
- }
102
- }
103
-
104
- return sortStatements ( leftPart ) . concat ( pivot , sortStatements ( rightPart ) )
90
+ return statements . sort ( ( stmtA , stmtB ) =>
91
+ isJestGlobalImport ( stmtA ) ||
92
+ ( isHoistableStatement ( stmtA ) && ! isHoistableStatement ( stmtB ) && ! isJestGlobalImport ( stmtB ) )
93
+ ? - 1
94
+ : 1 ,
95
+ )
105
96
}
106
97
107
98
const createVisitor = ( ctx : _ts . TransformationContext , _ : _ts . SourceFile ) => {
You can’t perform that action at this time.
0 commit comments