From b0623960f937f0050ffbb4ac0767ad74c2c071b4 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Sat, 19 Oct 2024 19:13:34 +0200 Subject: [PATCH] chore: add extra spaces and delete commented line --- packages/svelte/src/compiler/migrate/index.js | 7 +++---- .../output.svelte | 8 ++++---- .../$$slots-used-as-variable/output.svelte | 12 ++++++------ .../migrate/samples/css-ignore/output.svelte | 6 +++--- .../samples/jsdoc-with-comments/output.svelte | 16 ++++++++-------- .../samples/props-and-labeled/output.svelte | 8 ++++---- .../samples/props-rest-props/output.svelte | 6 +++--- .../tests/migrate/samples/props/output.svelte | 12 ++++++------ .../output.svelte | 6 +++--- .../samples/slots-below-imports/output.svelte | 6 +++--- .../migrate/samples/slots-multiple/output.svelte | 6 +++--- .../samples/slots-with-$$props/output.svelte | 10 +++++----- .../tests/migrate/samples/slots/output.svelte | 10 +++++----- 13 files changed, 56 insertions(+), 57 deletions(-) diff --git a/packages/svelte/src/compiler/migrate/index.js b/packages/svelte/src/compiler/migrate/index.js index 5ce56f687b87..b0867766e3d0 100644 --- a/packages/svelte/src/compiler/migrate/index.js +++ b/packages/svelte/src/compiler/migrate/index.js @@ -213,11 +213,11 @@ export function migrate(source, { filename } = {}) { } type += `\n${indent}}`; } else { - type = `/**\n${indent}* @typedef {Object} ${type_name}${state.props + type = `/**\n${indent} * @typedef {Object} ${type_name}${state.props .map((prop) => { - return `\n${indent}* @property {${prop.type}} ${prop.optional ? `[${prop.exported}]` : prop.exported}${prop.comment ? ` - ${prop.comment}` : ''}`; + return `\n${indent} * @property {${prop.type}} ${prop.optional ? `[${prop.exported}]` : prop.exported}${prop.comment ? ` - ${prop.comment}` : ''}`; }) - .join(``)}\n${indent}*/`; + .join(``)}\n${indent} */`; } let props_declaration = `let {${props_separator}${props}${has_many_props ? `\n${indent}` : ' '}}`; if (uses_ts) { @@ -1260,7 +1260,6 @@ function extract_type_and_comment(declarator, str, path) { // Try to find jsdoc above the declaration let comment_node = /** @type {Node} */ (parent)?.leadingComments?.at(-1); - //if (comment_node?.type !== 'Block') comment_node = undefined; const comment_start = /** @type {any} */ (comment_node)?.start; const comment_end = /** @type {any} */ (comment_node)?.end; diff --git a/packages/svelte/tests/migrate/samples/$$slots-used-as-variable-$$props/output.svelte b/packages/svelte/tests/migrate/samples/$$slots-used-as-variable-$$props/output.svelte index 4dbd50f5ebeb..c1a3e8d6363f 100644 --- a/packages/svelte/tests/migrate/samples/$$slots-used-as-variable-$$props/output.svelte +++ b/packages/svelte/tests/migrate/samples/$$slots-used-as-variable-$$props/output.svelte @@ -1,9 +1,9 @@