@@ -28,11 +28,11 @@ export function RenderTag(node, context) {
28
28
let resolved = callee . type === 'Identifier' && is_resolved_snippet ( binding ) ;
29
29
30
30
/** @type {AST.SnippetBlock | undefined } */
31
- let snippet
31
+ let snippet ;
32
32
33
33
if ( binding ?. initial ?. type === 'SnippetBlock' ) {
34
34
// if this render tag unambiguously references a local snippet, our job is easy
35
- snippet = binding . initial
35
+ snippet = binding . initial ;
36
36
node . metadata . snippets . add ( snippet ) ;
37
37
}
38
38
@@ -53,20 +53,22 @@ export function RenderTag(node, context) {
53
53
) {
54
54
e . render_tag_invalid_call_expression ( node ) ;
55
55
}
56
-
56
+
57
57
const parent = context . path . at ( - 2 ) ;
58
- const is_animated = snippet ?. body . nodes . some ( n => is_animate_directive ( n ) ) ;
58
+ const is_animated = snippet ?. body . nodes . some ( ( n ) => is_animate_directive ( n ) ) ;
59
59
60
- if ( is_animated ) {
60
+ if ( is_animated ) {
61
61
if ( parent ?. type !== 'EachBlock' ) {
62
62
e . animation_invalid_placement ( node ) ;
63
- }
64
- else if ( ! parent . key ) {
63
+ } else if ( ! parent . key ) {
65
64
e . animation_missing_key ( parent ) ;
66
- } else if ( parent . body . nodes . filter ( ( n ) =>
67
- n . type !== 'Comment' &&
68
- n . type !== 'ConstTag' &&
69
- ( n . type !== 'Text' || n . data . trim ( ) !== '' ) ) . length > 1
65
+ } else if (
66
+ parent . body . nodes . filter (
67
+ ( n ) =>
68
+ n . type !== 'Comment' &&
69
+ n . type !== 'ConstTag' &&
70
+ ( n . type !== 'Text' || n . data . trim ( ) !== '' )
71
+ ) . length > 1
70
72
) {
71
73
e . animation_invalid_placement ( node ) ;
72
74
}
@@ -77,17 +79,17 @@ export function RenderTag(node, context) {
77
79
context . next ( { ...context . state , render_tag : node } ) ;
78
80
}
79
81
80
- /**
82
+ /**
81
83
* @param {AST.Text | AST.Tag | AST.ElementLike | AST.Comment | AST.Block } child
82
84
* @param {boolean } render_snippet
83
85
* @returns {boolean }
84
- */
86
+ */
85
87
function is_animate_directive ( child , render_snippet = false ) {
86
88
if ( child . type === 'RenderTag' ) {
87
- if ( render_snippet ) return false // Prevent infinite recursion
89
+ if ( render_snippet ) return false ; // Prevent infinite recursion
88
90
for ( const snippet_block of child . metadata . snippets ) {
89
- if ( snippet_block . body . nodes . includes ( child ) ) break
90
- return snippet_block . body . nodes . some ( n => is_animate_directive ( n , true ) ) ;
91
+ if ( snippet_block . body . nodes . includes ( child ) ) break ;
92
+ return snippet_block . body . nodes . some ( ( n ) => is_animate_directive ( n , true ) ) ;
91
93
}
92
94
}
93
95
if ( child . type !== 'RegularElement' && child . type !== 'SvelteElement' ) return false ;
0 commit comments