@@ -647,7 +647,6 @@ function transformForDeclareReactiveVar(
647
647
ctx . appendOriginal ( statement . range [ 1 ] ) ;
648
648
ctx . appendVirtualScript ( `}` ) ;
649
649
650
- // eslint-disable-next-line complexity -- ignore X(
651
650
ctx . restoreContext . addRestoreStatementProcess ( ( node , result ) => {
652
651
if ( ( node as any ) . type !== "SvelteReactiveStatement" ) {
653
652
return false ;
@@ -818,55 +817,53 @@ function transformForDollarDerived(
818
817
819
818
ctx . restoreContext . addRestoreExpressionProcess < TSESTree . CallExpression > ( {
820
819
target : "CallExpression" as TSESTree . AST_NODE_TYPES . CallExpression ,
821
- restore :
822
- // eslint-disable-next-line complexity -- ignore
823
- ( node , result ) => {
824
- if (
825
- node . callee . type !== "Identifier" ||
826
- node . callee . name !== "$derived"
827
- ) {
828
- return false ;
829
- }
830
- const arg = node . arguments [ 0 ] ;
831
- if (
832
- ! arg ||
833
- arg . type !== "CallExpression" ||
834
- arg . arguments . length !== 0 ||
835
- arg . callee . type !== "ArrowFunctionExpression" ||
836
- arg . callee . body . type !== "BlockStatement" ||
837
- arg . callee . body . body . length !== 2 ||
838
- arg . callee . body . body [ 0 ] . type !== "ReturnStatement" ||
839
- arg . callee . body . body [ 0 ] . argument ?. type !== "CallExpression" ||
840
- arg . callee . body . body [ 0 ] . argument . callee . type !== "Identifier" ||
841
- arg . callee . body . body [ 0 ] . argument . callee . name !== functionId ||
842
- arg . callee . body . body [ 1 ] . type !== "FunctionDeclaration" ||
843
- arg . callee . body . body [ 1 ] . id . name !== functionId
844
- ) {
845
- return false ;
846
- }
847
- const fnNode = arg . callee . body . body [ 1 ] ;
848
- if (
849
- fnNode . body . body . length !== 1 ||
850
- fnNode . body . body [ 0 ] . type !== "ReturnStatement" ||
851
- ! fnNode . body . body [ 0 ] . argument
852
- ) {
853
- return false ;
854
- }
820
+ restore : ( node , result ) => {
821
+ if (
822
+ node . callee . type !== "Identifier" ||
823
+ node . callee . name !== "$derived"
824
+ ) {
825
+ return false ;
826
+ }
827
+ const arg = node . arguments [ 0 ] ;
828
+ if (
829
+ ! arg ||
830
+ arg . type !== "CallExpression" ||
831
+ arg . arguments . length !== 0 ||
832
+ arg . callee . type !== "ArrowFunctionExpression" ||
833
+ arg . callee . body . type !== "BlockStatement" ||
834
+ arg . callee . body . body . length !== 2 ||
835
+ arg . callee . body . body [ 0 ] . type !== "ReturnStatement" ||
836
+ arg . callee . body . body [ 0 ] . argument ?. type !== "CallExpression" ||
837
+ arg . callee . body . body [ 0 ] . argument . callee . type !== "Identifier" ||
838
+ arg . callee . body . body [ 0 ] . argument . callee . name !== functionId ||
839
+ arg . callee . body . body [ 1 ] . type !== "FunctionDeclaration" ||
840
+ arg . callee . body . body [ 1 ] . id . name !== functionId
841
+ ) {
842
+ return false ;
843
+ }
844
+ const fnNode = arg . callee . body . body [ 1 ] ;
845
+ if (
846
+ fnNode . body . body . length !== 1 ||
847
+ fnNode . body . body [ 0 ] . type !== "ReturnStatement" ||
848
+ ! fnNode . body . body [ 0 ] . argument
849
+ ) {
850
+ return false ;
851
+ }
855
852
856
- const expr = fnNode . body . body [ 0 ] . argument ;
853
+ const expr = fnNode . body . body [ 0 ] . argument ;
857
854
858
- node . arguments [ 0 ] = expr ;
859
- expr . parent = node ;
855
+ node . arguments [ 0 ] = expr ;
856
+ expr . parent = node ;
860
857
861
- const scopeManager = result . scopeManager as ScopeManager ;
862
- removeFunctionScope ( arg . callee . body . body [ 1 ] , scopeManager ) ;
863
- removeIdentifierReference (
864
- arg . callee . body . body [ 0 ] . argument . callee ,
865
- scopeManager . acquire ( arg . callee ) ! ,
866
- ) ;
867
- removeFunctionScope ( arg . callee , scopeManager ) ;
868
- return true ;
869
- } ,
858
+ const scopeManager = result . scopeManager as ScopeManager ;
859
+ removeFunctionScope ( arg . callee . body . body [ 1 ] , scopeManager ) ;
860
+ removeIdentifierReference (
861
+ arg . callee . body . body [ 0 ] . argument . callee ,
862
+ scopeManager . acquire ( arg . callee ) ! ,
863
+ ) ;
864
+ removeFunctionScope ( arg . callee , scopeManager ) ;
865
+ return true ;
866
+ } ,
870
867
} ) ;
871
868
}
872
869
0 commit comments