Skip to content

Commit 10c01bc

Browse files
committed
lint
1 parent e0ef1a5 commit 10c01bc

File tree

1 file changed

+18
-16
lines changed
  • packages/svelte/src/compiler/phases/2-analyze/visitors

1 file changed

+18
-16
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/RenderTag.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export function RenderTag(node, context) {
2828
let resolved = callee.type === 'Identifier' && is_resolved_snippet(binding);
2929

3030
/** @type {AST.SnippetBlock | undefined} */
31-
let snippet
31+
let snippet;
3232

3333
if (binding?.initial?.type === 'SnippetBlock') {
3434
// if this render tag unambiguously references a local snippet, our job is easy
35-
snippet = binding.initial
35+
snippet = binding.initial;
3636
node.metadata.snippets.add(snippet);
3737
}
3838

@@ -53,20 +53,22 @@ export function RenderTag(node, context) {
5353
) {
5454
e.render_tag_invalid_call_expression(node);
5555
}
56-
56+
5757
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));
5959

60-
if(is_animated) {
60+
if (is_animated) {
6161
if (parent?.type !== 'EachBlock') {
6262
e.animation_invalid_placement(node);
63-
}
64-
else if (!parent.key) {
63+
} else if (!parent.key) {
6564
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
7072
) {
7173
e.animation_invalid_placement(node);
7274
}
@@ -77,17 +79,17 @@ export function RenderTag(node, context) {
7779
context.next({ ...context.state, render_tag: node });
7880
}
7981

80-
/**
82+
/**
8183
* @param {AST.Text | AST.Tag | AST.ElementLike | AST.Comment | AST.Block} child
8284
* @param {boolean} render_snippet
8385
* @returns {boolean}
84-
*/
86+
*/
8587
function is_animate_directive(child, render_snippet = false) {
8688
if (child.type === 'RenderTag') {
87-
if(render_snippet) return false // Prevent infinite recursion
89+
if (render_snippet) return false; // Prevent infinite recursion
8890
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));
9193
}
9294
}
9395
if (child.type !== 'RegularElement' && child.type !== 'SvelteElement') return false;

0 commit comments

Comments
 (0)