Skip to content

Commit 268bb5c

Browse files
committed
Linter
1 parent ad874af commit 268bb5c

File tree

2 files changed

+44
-39
lines changed

2 files changed

+44
-39
lines changed

src/routes/(v2)/v2/issue-484/+page.svelte

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,45 @@
33
import { schemasafe } from '$lib/adapters/schemasafe.js';
44
import { loginJSONSchema } from './schemas.js';
55
6-
const { form, errors, message, constraints, enhance } = superForm(defaults(schemasafe(loginJSONSchema)), {
7-
SPA: true,
8-
validators: schemasafe(loginJSONSchema),
9-
onUpdate({ form }) {
10-
if (form.valid) {
11-
// TODO: Call an external API with form.data, await the result and update form
12-
}
13-
}
14-
});
6+
const { form, errors, message, constraints, enhance } = superForm(
7+
defaults(schemasafe(loginJSONSchema)),
8+
{
9+
SPA: true,
10+
validators: schemasafe(loginJSONSchema),
11+
onUpdate({ form }) {
12+
if (form.valid) {
13+
// TODO: Call an external API with form.data, await the result and update form
14+
}
15+
}
16+
}
17+
);
1518
</script>
1619

1720
<h1>Edit user</h1>
1821

1922
{#if $message}<h3>{$message}</h3>{/if}
2023

2124
<form method="POST" use:enhance>
22-
<label>
23-
Name<br />
24-
<input
25-
aria-invalid={$errors.name ? 'true' : undefined}
26-
bind:value={$form.name}
27-
{...$constraints.name} />
28-
</label>
29-
{#if $errors.name}<span class="invalid">{$errors.name}</span>{/if}
25+
<label>
26+
Name<br />
27+
<input
28+
aria-invalid={$errors.name ? 'true' : undefined}
29+
bind:value={$form.name}
30+
{...$constraints.name}
31+
/>
32+
</label>
33+
{#if $errors.name}<span class="invalid">{$errors.name}</span>{/if}
3034

31-
<label>
32-
E-mail<br />
33-
<input
34-
type="email"
35-
aria-invalid={$errors.email ? 'true' : undefined}
36-
bind:value={$form.email}
37-
{...$constraints.email} />
38-
</label>
39-
{#if $errors.email}<span class="invalid">{$errors.email}</span>{/if}
40-
<br />
41-
<button>Submit</button>
42-
</form>
35+
<label>
36+
E-mail<br />
37+
<input
38+
type="email"
39+
aria-invalid={$errors.email ? 'true' : undefined}
40+
bind:value={$form.email}
41+
{...$constraints.email}
42+
/>
43+
</label>
44+
{#if $errors.email}<span class="invalid">{$errors.email}</span>{/if}
45+
<br />
46+
<button>Submit</button>
47+
</form>

src/routes/(v2)/v2/issue-484/schemas.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { z } from 'zod';
22
import type { JSONSchema } from '$lib/index.js';
33

44
export const loginZodSchema = z.object({
5-
name: z.string().min(5).default('Superform'),
6-
email: z.string().email()
5+
name: z.string().min(5).default('Superform'),
6+
email: z.string().email()
77
});
88

99
export const loginJSONSchema = {
10-
type: 'object',
11-
properties: {
12-
name: { type: 'string', minLength: 5, default: 'Superform' },
13-
email: { type: 'string', format: 'email' }
14-
},
15-
required: ['name', 'email'],
16-
additionalProperties: false,
17-
$schema: 'http://json-schema.org/draft-07/schema#'
10+
type: 'object',
11+
properties: {
12+
name: { type: 'string', minLength: 5, default: 'Superform' },
13+
email: { type: 'string', format: 'email' }
14+
},
15+
required: ['name', 'email'],
16+
additionalProperties: false,
17+
$schema: 'http://json-schema.org/draft-07/schema#'
1818
} as const satisfies JSONSchema;

0 commit comments

Comments
 (0)