Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .claude/rules/sveltekit.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ const homeHref = resolve('/');

**External links** — add `rel="noreferrer external"` instead of wrapping with `resolve()`.

**Do not pass query strings to `resolve()`** — `resolve()` accepts route patterns only (e.g. `'/workbooks'`). A path like `'/workbooks?tab=foo'` is not a valid route pattern and causes a type error. Split path and search before passing: `resolve(url.pathname) + url.search`.
**With query string or hash** — `svelte/no-navigation-without-resolve` (eslint-plugin-svelte 3.16.0+) requires the _entire_ first argument to be a direct `resolve()` call. Concatenating `resolve(path) + search` is now rejected. Pass path, search, and hash as a single concatenated string inside `resolve()`:

**Do not apply `resolve()` to URLs derived from `$page.url`** — `$page.url` is the actual browser URL with the base path already applied. Wrapping a value derived from it with `resolve()` double-applies the base path. Pass the `URL` object directly to `replaceState` or extract `.pathname + .search` without `resolve()`.
```typescript
// Bad — rejected by eslint-plugin-svelte 3.16.0+
goto(resolve(url.pathname) + url.search);
replaceState(resolve(url.pathname) + url.search + url.hash, state);

// Good
goto(resolve(url.pathname + url.search));
replaceState(resolve(url.pathname + url.search + url.hash), state);
```

## Page Component Props

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
selectedGrades,
);
// @ts-expect-error svelte-check TS2554: AppTypes declaration merging causes RouteId to resolve as string, requiring params. Runtime behavior is correct.
replaceState(resolve(updatedUrl.pathname) + updatedUrl.search + updatedUrl.hash, $page.state);
replaceState(resolve(updatedUrl.pathname + updatedUrl.search + updatedUrl.hash), $page.state);
}

let allItems = $state<Record<string, KanbanColumns>>(
Expand Down
19 changes: 11 additions & 8 deletions src/routes/users/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
message_type: string;
message: string;
};
status?: string;
}

let { data, status = $bindable('nothing') }: Props = $props();
let { data }: Props = $props();
// TODO: Restore when AtCoderUserValidationForm is re-enabled (svelte/valid-prop-names-in-kit-pages requires $bindable props to be declared in Props):
// interface Props { ...; status?: string; }
// let { data, status = $bindable('nothing') }: Props = $props();
// let status = $state('nothing');

let role = data.role;
let username = data.username;
Expand All @@ -35,12 +38,12 @@
let message = data.message;
let message_type = data.message_type;

if (data.is_validated) {
status = 'validated';
}
if (data.atcoder_username.length > 0 && data.atcoder_validationcode.length > 0) {
status = 'generated';
}
// if (data.is_validated) {
// status = 'validated';
// }
// if (data.atcoder_username.length > 0 && data.atcoder_validationcode.length > 0) {
// status = 'generated';
// }

const isGeneralUser = (userRole: Roles, userName: string) => {
return userRole === Roles.USER && userName !== 'guest';
Expand Down
2 changes: 1 addition & 1 deletion src/routes/workbooks/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if (saved) {
const savedUrl = new URL(saved, window.location.origin);
// @ts-expect-error svelte-check TS2554: AppTypes declaration merging causes RouteId to resolve as string, requiring params. Runtime behavior is correct.
goto(resolve(savedUrl.pathname) + savedUrl.search, { replaceState: true });
goto(resolve(savedUrl.pathname + savedUrl.search), { replaceState: true });
}
});

Expand Down
Loading