feat(frontend): add ESLint and Prettier with Svelte support
- Install eslint, prettier and related plugins - Add lint and format npm scripts - Configure eslint.config.js with Svelte + TypeScript rules - Configure .prettierrc with Svelte plugin - Fix code to comply with lint rules: - Use resolve() for navigation links - Use SvelteMap for reactive maps - Use writable instead of + - Remove unused imports and variables Note: ignoreGoto is set to true due to eslint-plugin-svelte#1327
This commit is contained in:
parent
609995732b
commit
098b158b75
16 changed files with 2626 additions and 726 deletions
|
|
@ -1,8 +1,9 @@
|
|||
<script lang="ts">
|
||||
import { enhance } from '$app/forms';
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import type { ActionData, PageData } from './$types';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
import { Badge } from '$lib/components/ui/badge';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card';
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
|
|
@ -16,7 +17,6 @@
|
|||
TableHeader,
|
||||
TableRow
|
||||
} from '$lib/components/ui/table';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
let { data, form }: { data: PageData; form: ActionData } = $props();
|
||||
|
||||
|
|
@ -33,6 +33,12 @@
|
|||
let showForm = $state(false);
|
||||
let selectedFlag = $state('');
|
||||
let filterFlag = $derived(data.flag ?? '');
|
||||
|
||||
function onFlagChange(v: string) {
|
||||
const base = resolve('/health/lab-results');
|
||||
const url = v ? base + '?flag=' + v : base;
|
||||
goto(url, { replaceState: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head><title>{m["labResults_title"]()} — innercontext</title></svelte:head>
|
||||
|
|
@ -61,9 +67,7 @@
|
|||
<Select
|
||||
type="single"
|
||||
value={filterFlag}
|
||||
onValueChange={(v) => {
|
||||
goto(v ? `/health/lab-results?flag=${v}` : '/health/lab-results');
|
||||
}}
|
||||
onValueChange={onFlagChange}
|
||||
>
|
||||
<SelectTrigger class="w-32">{filterFlag || m["labResults_flagAll"]()}</SelectTrigger>
|
||||
<SelectContent>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue