From 7b4803a72ac224d8fa38b8c3455311e97616b567 Mon Sep 17 00:00:00 2001 From: josef Date: Wed, 17 Aug 2022 11:24:37 -0500 Subject: [PATCH] chore: give verbose names to form args "e" (#5983) * chore: give verbose names to form args "e" * Create chilled-years-smash.md Co-authored-by: Rich Harris --- .changeset/chilled-years-smash.md | 5 +++++ .../templates/default/src/lib/form.ts | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .changeset/chilled-years-smash.md diff --git a/.changeset/chilled-years-smash.md b/.changeset/chilled-years-smash.md new file mode 100644 index 000000000000..44f23128b65a --- /dev/null +++ b/.changeset/chilled-years-smash.md @@ -0,0 +1,5 @@ +--- +"create-svelte": patch +--- + +make variable names more descriptive diff --git a/packages/create-svelte/templates/default/src/lib/form.ts b/packages/create-svelte/templates/default/src/lib/form.ts index c3a1933da66e..f4f1153ffdce 100644 --- a/packages/create-svelte/templates/default/src/lib/form.ts +++ b/packages/create-svelte/templates/default/src/lib/form.ts @@ -60,11 +60,11 @@ export function enhance( ) { let current_token: unknown; - /** @param {SubmitEvent} e */ - async function handle_submit(e: SubmitEvent) { + /** @param {SubmitEvent} event */ + async function handle_submit(event: SubmitEvent) { const token = (current_token = {}); - e.preventDefault(); + event.preventDefault(); const data = new FormData(form); @@ -92,11 +92,11 @@ export function enhance( } else { console.error(await response.text()); } - } catch (e: unknown) { - if (error && e instanceof Error) { - error({ data, form, error: e, response: null }); + } catch (err: unknown) { + if (error && err instanceof Error) { + error({ data, form, error: err, response: null }); } else { - throw e; + throw err; } } }