refactor: run formatter

This commit is contained in:
Elias Schneider
2025-11-30 18:17:22 +01:00
parent 5d6a7fdb58
commit 14c7471b52
14 changed files with 137 additions and 118 deletions

View File

@@ -3,6 +3,6 @@
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"printWidth": 100, "printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], "plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
} }

View File

@@ -1,63 +1,63 @@
{ {
"name": "pocket-id-frontend", "name": "pocket-id-frontend",
"version": "1.15.0", "version": "1.15.0",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"dev": "vite dev --port 3000", "dev": "vite dev --port 3000",
"build": "vite build", "build": "vite build",
"preview": "vite preview --port 3000", "preview": "vite preview --port 3000",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .", "lint": "prettier --check . && eslint .",
"format": "prettier --write ." "format": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"@simplewebauthn/browser": "^13.2.2", "@simplewebauthn/browser": "^13.2.2",
"@tailwindcss/vite": "^4.1.17", "@tailwindcss/vite": "^4.1.17",
"axios": "^1.13.2", "axios": "^1.13.2",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"jose": "^6.1.2", "jose": "^6.1.2",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"runed": "^0.37.0", "runed": "^0.37.0",
"sveltekit-superforms": "^2.28.1", "sveltekit-superforms": "^2.28.1",
"tailwind-merge": "^3.4.0", "tailwind-merge": "^3.4.0",
"zod": "^4.1.13" "zod": "^4.1.13"
}, },
"devDependencies": { "devDependencies": {
"@inlang/paraglide-js": "^2.5.0", "@inlang/paraglide-js": "^2.5.0",
"@inlang/plugin-m-function-matcher": "^2.1.0", "@inlang/plugin-m-function-matcher": "^2.1.0",
"@inlang/plugin-message-format": "^4.0.0", "@inlang/plugin-message-format": "^4.0.0",
"@internationalized/date": "^3.10.0", "@internationalized/date": "^3.10.0",
"@lucide/svelte": "^0.555.0", "@lucide/svelte": "^0.555.0",
"@sveltejs/adapter-static": "^3.0.10", "@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.49.0", "@sveltejs/kit": "^2.49.0",
"@sveltejs/vite-plugin-svelte": "^6.2.1", "@sveltejs/vite-plugin-svelte": "^6.2.1",
"@types/eslint": "^9.6.1", "@types/eslint": "^9.6.1",
"@types/node": "^24.10.1", "@types/node": "^24.10.1",
"@types/qrcode": "^1.5.6", "@types/qrcode": "^1.5.6",
"bits-ui": "^2.14.4", "bits-ui": "^2.14.4",
"eslint": "^9.39.1", "eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.13.0", "eslint-plugin-svelte": "^3.13.0",
"formsnap": "^2.0.1", "formsnap": "^2.0.1",
"globals": "^16.5.0", "globals": "^16.5.0",
"mode-watcher": "^1.1.0", "mode-watcher": "^1.1.0",
"prettier": "^3.7.0", "prettier": "^3.7.3",
"prettier-plugin-svelte": "^3.4.0", "prettier-plugin-svelte": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.7.1", "prettier-plugin-tailwindcss": "^0.7.1",
"rollup": "^4.53.3", "rollup": "^4.53.3",
"svelte": "^5.45.2", "svelte": "^5.45.2",
"svelte-check": "^4.3.4", "svelte-check": "^4.3.4",
"svelte-sonner": "^1.0.6", "svelte-sonner": "^1.0.6",
"tailwind-variants": "^3.2.2", "tailwind-variants": "^3.2.2",
"tailwindcss": "^4.1.17", "tailwindcss": "^4.1.17",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"tw-animate-css": "^1.4.0", "tw-animate-css": "^1.4.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.48.0", "typescript-eslint": "^8.48.0",
"vite": "^7.2.4" "vite": "^7.2.4"
} }
} }

View File

@@ -4,7 +4,7 @@
import * as Command from '$lib/components/ui/command'; import * as Command from '$lib/components/ui/command';
import * as Popover from '$lib/components/ui/popover'; import * as Popover from '$lib/components/ui/popover';
import { cn } from '$lib/utils/style'; import { cn } from '$lib/utils/style';
import { m } from '$lib/paraglide/messages'; import { m } from '$lib/paraglide/messages';
import { LoaderCircle, LucideCheck, LucideChevronDown } from '@lucide/svelte'; import { LoaderCircle, LucideCheck, LucideChevronDown } from '@lucide/svelte';
import type { FormEventHandler } from 'svelte/elements'; import type { FormEventHandler } from 'svelte/elements';

View File

@@ -1,11 +1,11 @@
<script lang="ts"> <script lang="ts">
import SunIcon from '@lucide/svelte/icons/sun';
import MoonIcon from '@lucide/svelte/icons/moon'; import MoonIcon from '@lucide/svelte/icons/moon';
import SunIcon from '@lucide/svelte/icons/sun';
import { mode, resetMode, setMode } from 'mode-watcher';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { buttonVariants } from '$lib/components/ui/button/index.js'; import { buttonVariants } from '$lib/components/ui/button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { m } from '$lib/paraglide/messages'; import { m } from '$lib/paraglide/messages';
import { mode, resetMode, setMode } from 'mode-watcher';
const isDark = $derived(mode.current === 'dark'); const isDark = $derived(mode.current === 'dark');
</script> </script>

View File

@@ -36,7 +36,10 @@
async function createLoginCode() { async function createLoginCode() {
try { try {
code = await userService.createOneTimeAccessToken(userId!, availableExpirations[selectedExpiration]); code = await userService.createOneTimeAccessToken(
userId!,
availableExpirations[selectedExpiration]
);
oneTimeLink = `${page.url.origin}/lc/${code}`; oneTimeLink = `${page.url.origin}/lc/${code}`;
} catch (e) { } catch (e) {
axiosErrorToast(e); axiosErrorToast(e);
@@ -45,7 +48,10 @@
async function sendLoginCodeEmail() { async function sendLoginCodeEmail() {
try { try {
await userService.requestOneTimeAccessEmailAsAdmin(userId!, availableExpirations[selectedExpiration]); await userService.requestOneTimeAccessEmailAsAdmin(
userId!,
availableExpirations[selectedExpiration]
);
toast.success(m.login_code_email_success()); toast.success(m.login_code_email_success());
onOpenChange(false); onOpenChange(false);
} catch (e) { } catch (e) {

View File

@@ -1,7 +1,7 @@
import Root from "./skeleton.svelte"; import Root from './skeleton.svelte';
export { export {
Root, Root,
// //
Root as Skeleton, Root as Skeleton
}; };

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { cn, type WithElementRef, type WithoutChildren } from "$lib/utils/style.js"; import { cn, type WithElementRef, type WithoutChildren } from '$lib/utils/style.js';
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from 'svelte/elements';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,6 +12,6 @@
<div <div
bind:this={ref} bind:this={ref}
data-slot="skeleton" data-slot="skeleton"
class={cn("bg-accent animate-pulse rounded-md", className)} class={cn('bg-accent animate-pulse rounded-md', className)}
{...restProps} {...restProps}
></div> ></div>

View File

@@ -1,13 +1,13 @@
import axios from 'axios'; import axios from 'axios';
abstract class APIService { abstract class APIService {
protected api = axios.create({ baseURL: '/api' }); protected api = axios.create({ baseURL: '/api' });
constructor() { constructor() {
if (typeof process !== 'undefined' && process?.env?.DEVELOPMENT_BACKEND_URL) { if (typeof process !== 'undefined' && process?.env?.DEVELOPMENT_BACKEND_URL) {
this.api.defaults.baseURL = process.env.DEVELOPMENT_BACKEND_URL; this.api.defaults.baseURL = process.env.DEVELOPMENT_BACKEND_URL;
} }
} }
} }
export default APIService; export default APIService;

View File

@@ -4,35 +4,35 @@ import APIService from './api-service';
import userStore from '$lib/stores/user-store'; import userStore from '$lib/stores/user-store';
import type { AuthenticationResponseJSON, RegistrationResponseJSON } from '@simplewebauthn/browser'; import type { AuthenticationResponseJSON, RegistrationResponseJSON } from '@simplewebauthn/browser';
class WebAuthnService extends APIService { class WebAuthnService extends APIService {
getRegistrationOptions = async () => (await this.api.get(`/webauthn/register/start`)).data; getRegistrationOptions = async () => (await this.api.get(`/webauthn/register/start`)).data;
finishRegistration = async (body: RegistrationResponseJSON) => finishRegistration = async (body: RegistrationResponseJSON) =>
(await this.api.post(`/webauthn/register/finish`, body)).data as Passkey; (await this.api.post(`/webauthn/register/finish`, body)).data as Passkey;
getLoginOptions = async () => (await this.api.get(`/webauthn/login/start`)).data; getLoginOptions = async () => (await this.api.get(`/webauthn/login/start`)).data;
finishLogin = async (body: AuthenticationResponseJSON) => finishLogin = async (body: AuthenticationResponseJSON) =>
(await this.api.post(`/webauthn/login/finish`, body)).data as User; (await this.api.post(`/webauthn/login/finish`, body)).data as User;
logout = async () => { logout = async () => {
await this.api.post(`/webauthn/logout`); await this.api.post(`/webauthn/logout`);
userStore.clearUser(); userStore.clearUser();
}; };
listCredentials = async () => (await this.api.get(`/webauthn/credentials`)).data as Passkey[]; listCredentials = async () => (await this.api.get(`/webauthn/credentials`)).data as Passkey[];
removeCredential = async (id: string) => { removeCredential = async (id: string) => {
await this.api.delete(`/webauthn/credentials/${id}`); await this.api.delete(`/webauthn/credentials/${id}`);
}; };
updateCredentialName = async (id: string, name: string) => { updateCredentialName = async (id: string, name: string) => {
await this.api.patch(`/webauthn/credentials/${id}`, { name }); await this.api.patch(`/webauthn/credentials/${id}`, { name });
}; };
reauthenticate = async (body?: AuthenticationResponseJSON) => { reauthenticate = async (body?: AuthenticationResponseJSON) => {
const res = await this.api.post('/webauthn/reauthenticate', body); const res = await this.api.post('/webauthn/reauthenticate', body);
return res.data.reauthenticationToken as string; return res.data.reauthenticationToken as string;
}; };
} }
export default WebAuthnService; export default WebAuthnService;

View File

@@ -3,7 +3,7 @@ import type { Component, Snippet } from 'svelte';
export type AdvancedTableColumn<T extends Record<string, any>> = { export type AdvancedTableColumn<T extends Record<string, any>> = {
label: string; label: string;
column?: keyof T & string; column?: keyof T & string;
key?: string; key?: string;
value?: (item: T) => string | number | boolean | undefined; value?: (item: T) => string | number | boolean | undefined;
cell?: Snippet<[{ item: T }]>; cell?: Snippet<[{ item: T }]>;
sortable?: boolean; sortable?: boolean;
@@ -12,9 +12,11 @@ export type AdvancedTableColumn<T extends Record<string, any>> = {
value: string | boolean; value: string | boolean;
icon?: Component; icon?: Component;
}[]; }[];
hidden?: boolean; hidden?: boolean;
}; };
export type CreateAdvancedTableActions<T extends Record<string, any>> = (item: T) => AdvancedTableAction<T>[]; export type CreateAdvancedTableActions<T extends Record<string, any>> = (
item: T
) => AdvancedTableAction<T>[];
export type AdvancedTableAction<T> = { export type AdvancedTableAction<T> = {
label: string; label: string;

View File

@@ -9,8 +9,8 @@ export const eventTypes: Record<string, string> = {
DEVICE_CODE_AUTHORIZATION: m.device_code_authorization(), DEVICE_CODE_AUTHORIZATION: m.device_code_authorization(),
NEW_DEVICE_CODE_AUTHORIZATION: m.new_device_code_authorization(), NEW_DEVICE_CODE_AUTHORIZATION: m.new_device_code_authorization(),
PASSKEY_ADDED: m.passkey_added(), PASSKEY_ADDED: m.passkey_added(),
PASSKEY_REMOVED: m.passkey_removed(), PASSKEY_REMOVED: m.passkey_removed()
} };
/** /**
* Translates an audit log event type using paraglide messages. * Translates an audit log event type using paraglide messages.

View File

@@ -22,9 +22,13 @@ export const cachedApplicationLogo: CachableImage = {
export const cachedDefaultProfilePicture: CachableImage = { export const cachedDefaultProfilePicture: CachableImage = {
getUrl: () => getUrl: () =>
getCachedImageUrl(new URL('/api/application-images/default-profile-picture', window.location.origin)), getCachedImageUrl(
new URL('/api/application-images/default-profile-picture', window.location.origin)
),
bustCache: () => bustCache: () =>
bustImageCache(new URL('/api/application-images/default-profile-picture', window.location.origin)) bustImageCache(
new URL('/api/application-images/default-profile-picture', window.location.origin)
)
}; };
export const cachedBackgroundImage: CachableImage = { export const cachedBackgroundImage: CachableImage = {

View File

@@ -72,7 +72,7 @@
value, value,
label label
})) }))
]} ]}
bind:value={filters.event} bind:value={filters.event}
/> />
</div> </div>

27
pnpm-lock.yaml generated
View File

@@ -141,14 +141,14 @@ importers:
specifier: ^1.1.0 specifier: ^1.1.0
version: 1.1.0(svelte@5.45.2) version: 1.1.0(svelte@5.45.2)
prettier: prettier:
specifier: ^3.7.0 specifier: ^3.7.3
version: 3.7.0 version: 3.7.3
prettier-plugin-svelte: prettier-plugin-svelte:
specifier: ^3.4.0 specifier: ^3.4.0
version: 3.4.0(prettier@3.7.0)(svelte@5.45.2) version: 3.4.0(prettier@3.7.3)(svelte@5.45.2)
prettier-plugin-tailwindcss: prettier-plugin-tailwindcss:
specifier: ^0.7.1 specifier: ^0.7.1
version: 0.7.1(prettier-plugin-svelte@3.4.0(prettier@3.7.0)(svelte@5.45.2))(prettier@3.7.0) version: 0.7.1(prettier-plugin-svelte@3.4.0(prettier@3.7.3)(svelte@5.45.2))(prettier@3.7.3)
rollup: rollup:
specifier: ^4.53.3 specifier: ^4.53.3
version: 4.53.3 version: 4.53.3
@@ -2422,6 +2422,11 @@ packages:
engines: {node: '>=14'} engines: {node: '>=14'}
hasBin: true hasBin: true
prettier@3.7.3:
resolution: {integrity: sha512-QgODejq9K3OzoBbuyobZlUhznP5SKwPqp+6Q6xw6o8gnhr4O85L2U915iM2IDcfF2NPXVaM9zlo9tdwipnYwzg==}
engines: {node: '>=14'}
hasBin: true
prismjs@1.30.0: prismjs@1.30.0:
resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==} resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==}
engines: {node: '>=6'} engines: {node: '>=6'}
@@ -3534,7 +3539,7 @@ snapshots:
'@react-email/render@2.0.0(react-dom@19.2.0(react@19.2.0))(react@19.2.0)': '@react-email/render@2.0.0(react-dom@19.2.0(react@19.2.0))(react@19.2.0)':
dependencies: dependencies:
html-to-text: 9.0.5 html-to-text: 9.0.5
prettier: 3.7.0 prettier: 3.7.3
react: 19.2.0 react: 19.2.0
react-dom: 19.2.0(react@19.2.0) react-dom: 19.2.0(react@19.2.0)
@@ -4938,19 +4943,21 @@ snapshots:
prelude-ls@1.2.1: {} prelude-ls@1.2.1: {}
prettier-plugin-svelte@3.4.0(prettier@3.7.0)(svelte@5.45.2): prettier-plugin-svelte@3.4.0(prettier@3.7.3)(svelte@5.45.2):
dependencies: dependencies:
prettier: 3.7.0 prettier: 3.7.3
svelte: 5.45.2 svelte: 5.45.2
prettier-plugin-tailwindcss@0.7.1(prettier-plugin-svelte@3.4.0(prettier@3.7.0)(svelte@5.45.2))(prettier@3.7.0): prettier-plugin-tailwindcss@0.7.1(prettier-plugin-svelte@3.4.0(prettier@3.7.3)(svelte@5.45.2))(prettier@3.7.3):
dependencies: dependencies:
prettier: 3.7.0 prettier: 3.7.3
optionalDependencies: optionalDependencies:
prettier-plugin-svelte: 3.4.0(prettier@3.7.0)(svelte@5.45.2) prettier-plugin-svelte: 3.4.0(prettier@3.7.3)(svelte@5.45.2)
prettier@3.7.0: {} prettier@3.7.0: {}
prettier@3.7.3: {}
prismjs@1.30.0: {} prismjs@1.30.0: {}
prompts@2.4.2: prompts@2.4.2: