Skip to content

Commit

Permalink
chore: give verbose names to form args "e" (#5983)
Browse files Browse the repository at this point in the history
* chore: give verbose names to form args "e"

* Create chilled-years-smash.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>
  • Loading branch information
josefaidt and Rich-Harris authored Aug 17, 2022
1 parent e46ec80 commit 7b4803a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-years-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-svelte": patch
---

make variable names more descriptive
14 changes: 7 additions & 7 deletions packages/create-svelte/templates/default/src/lib/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 7b4803a

Please sign in to comment.