From de0ff76c8fb4c824ae82cab7d34ed59db872839c Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sun, 30 Mar 2025 09:08:20 -0700 Subject: [PATCH] chore(scripts): fix lints --- scripts/build-docs.js | 4 ++-- scripts/format-component-api.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/build-docs.js b/scripts/build-docs.js index 2378f5d8..96fcff45 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -22,7 +22,7 @@ sveld({ }, }); -globSync(["./src/**/*.d.ts"]).forEach((file) => { +for (const file of globSync(["./src/**/*.d.ts"])) { console.log("Copying", file, " to types/"); fs.copyFileSync(file, file.replace(/src/, "types")); -}); +} diff --git a/scripts/format-component-api.js b/scripts/format-component-api.js index ddf8bdaf..df2e31ba 100644 --- a/scripts/format-component-api.js +++ b/scripts/format-component-api.js @@ -15,7 +15,7 @@ const formatTypeScript = async (value) => { console.time("formatComponentApi"); -let modified = { ...componentApi }; +const modified = { ...componentApi }; modified.components = await Promise.all( componentApi.components.map(async (component) => { @@ -26,7 +26,7 @@ modified.components = await Promise.all( } let normalizedValue = prop.value; - let prefix = `const ${prop.name} = `; + const prefix = `const ${prop.name} = `; if (prop.isFunction || prop.value.startsWith("{")) { normalizedValue = prefix + prop.value; @@ -64,7 +64,7 @@ modified.components = await Promise.all( return event; } - let normalizedValue = `type EventDetail = ` + event.detail; + const normalizedValue = `type EventDetail = ${event.detail}`; const formatted = (await formatTypeScript(normalizedValue)) // Remove prefix needed for formatting. @@ -88,7 +88,7 @@ modified.components = await Promise.all( let normalizedValue = slot.slot_props; if (normalizedValue.startsWith("{")) { - normalizedValue = `type SlotProps = ` + normalizedValue; + normalizedValue = `type SlotProps = ${normalizedValue}`; } const formatted = (await formatTypeScript(normalizedValue))