Skip to content

Commit 4920e7e

Browse files
committed
fix: resolve eslint errors for CI compliance
- remove unused imports across components and routes - add keys to all {#each} blocks to fix svelte/require-each-key - configure no-unused-vars to allow underscore-prefixed variables - fix $effect patterns to avoid no-unused-expressions - disable svelte/no-navigation-without-resolve (Button handles internally) - Button component now resolves hrefs internally using resolveRoute
1 parent 3500013 commit 4920e7e

File tree

15 files changed

+38
-40
lines changed

15 files changed

+38
-40
lines changed

eslint.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export default defineConfig(
2424
rules: {
2525
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
2626
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
27-
'no-undef': 'off'
27+
'no-undef': 'off',
28+
'@typescript-eslint/no-unused-vars': [
29+
'error',
30+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }
31+
]
2832
}
2933
},
3034
{
@@ -36,6 +40,10 @@ export default defineConfig(
3640
parser: ts.parser,
3741
svelteConfig
3842
}
43+
},
44+
rules: {
45+
// Disabled: Button component handles resolveRoute internally
46+
'svelte/no-navigation-without-resolve': 'off'
3947
}
4048
}
4149
);

src/lib/components/custom/assessment-results.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Strengths
4949
</h3>
5050
<ul class="space-y-3">
51-
{#each assessment.pros as pro}
51+
{#each assessment.pros as pro, i (i)}
5252
<li class="flex items-start gap-3">
5353
<CheckCircle2 class="mt-0.5 h-5 w-5 flex-shrink-0 text-green-600 dark:text-green-400" />
5454
<span class="text-sm leading-relaxed">{pro}</span>
@@ -68,7 +68,7 @@
6868
Concerns
6969
</h3>
7070
<ul class="space-y-3">
71-
{#each assessment.cons as con}
71+
{#each assessment.cons as con, i (i)}
7272
<li class="flex items-start gap-3">
7373
<XCircle class="mt-0.5 h-5 w-5 flex-shrink-0 text-red-600 dark:text-red-400" />
7474
<span class="text-sm leading-relaxed">{con}</span>

src/lib/components/custom/history-item.svelte

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
}
2929
}
3030
31-
function getScoreColor(score: number): string {
32-
if (score >= 8) return 'bg-green-500';
33-
if (score >= 6) return 'bg-yellow-500';
34-
return 'bg-red-500';
35-
}
36-
3731
function getScoreVariant(score: number): 'default' | 'secondary' | 'destructive' | 'outline' {
3832
if (score >= 8) return 'default';
3933
if (score >= 6) return 'secondary';
@@ -84,7 +78,7 @@
8478
<div>
8579
<h4 class="mb-2 text-sm font-semibold text-green-600 dark:text-green-500">Pros</h4>
8680
<ul class="space-y-1 text-sm">
87-
{#each entry.assessment.pros.slice(0, 3) as pro}
81+
{#each entry.assessment.pros.slice(0, 3) as pro, i (i)}
8882
<li class="text-muted-foreground">• {pro}</li>
8983
{/each}
9084
{#if entry.assessment.pros.length > 3}
@@ -100,7 +94,7 @@
10094
<div>
10195
<h4 class="mb-2 text-sm font-semibold text-red-600 dark:text-red-500">Cons</h4>
10296
<ul class="space-y-1 text-sm">
103-
{#each entry.assessment.cons.slice(0, 3) as con}
97+
{#each entry.assessment.cons.slice(0, 3) as con, i (i)}
10498
<li class="text-muted-foreground">• {con}</li>
10599
{/each}
106100
{#if entry.assessment.cons.length > 3}
@@ -117,7 +111,7 @@
117111
<div class="mt-4 border-t pt-4">
118112
<h4 class="mb-2 text-xs font-semibold text-muted-foreground">Key Ingredients</h4>
119113
<div class="flex flex-wrap gap-1">
120-
{#each entry.product.ingredients.slice(0, 5) as ingredient}
114+
{#each entry.product.ingredients.slice(0, 5) as ingredient, i (i)}
121115
<Badge variant="outline" class="text-xs">{ingredient}</Badge>
122116
{/each}
123117
{#if entry.product.ingredients.length > 5}

src/lib/components/custom/image-upload.svelte

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44
import { Input } from '$lib/components/ui/input';
55
import { Label } from '$lib/components/ui/label';
66
import { Badge } from '$lib/components/ui/badge';
7-
import {
8-
Camera,
9-
Upload,
10-
SwitchCamera,
11-
X,
12-
Sparkles,
13-
RefreshCw,
14-
Image as ImageIcon
15-
} from '@lucide/svelte';
7+
import { Camera, SwitchCamera, X, Sparkles, RefreshCw, Image as ImageIcon } from '@lucide/svelte';
168
import { onMount } from 'svelte';
179
1810
interface Props {
@@ -292,7 +284,7 @@
292284

293285
<!-- Image Previews Grid -->
294286
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4">
295-
{#each images as image, index}
287+
{#each images as image, index (index)}
296288
<div
297289
class="group relative aspect-square overflow-hidden rounded-xl border-2 bg-muted shadow-sm transition-shadow hover:shadow-md"
298290
>

src/lib/components/custom/product-info.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { Button } from '$lib/components/ui/button';
32
import * as Card from '$lib/components/ui/card';
43
import { Badge } from '$lib/components/ui/badge';
54
import { Package, FileText, FlaskConical } from '@lucide/svelte';
@@ -47,7 +46,7 @@
4746
Ingredients ({product.ingredients.length})
4847
</h3>
4948
<div class="flex flex-wrap gap-2">
50-
{#each product.ingredients as ingredient}
49+
{#each product.ingredients as ingredient, i (i)}
5150
<Badge variant="secondary" class="px-3 py-1.5 text-sm">{ingredient}</Badge>
5251
{/each}
5352
</div>

src/lib/components/ui/button/button.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
</script>
4343

4444
<script lang="ts">
45+
import { resolveRoute } from '$app/paths';
46+
4547
let {
4648
class: className,
4749
variant = 'default',
@@ -53,14 +55,17 @@
5355
children,
5456
...restProps
5557
}: ButtonProps = $props();
58+
59+
// Resolve the route for internal navigation
60+
const resolvedHref = $derived(href ? resolveRoute(href as '/') : undefined);
5661
</script>
5762

5863
{#if href}
5964
<a
6065
bind:this={ref}
6166
data-slot="button"
6267
class={cn(buttonVariants({ variant, size }), className)}
63-
href={disabled ? undefined : href}
68+
href={disabled ? undefined : resolvedHref}
6469
aria-disabled={disabled}
6570
role={disabled ? 'link' : undefined}
6671
tabindex={disabled ? -1 : undefined}

src/lib/db/firestore-history.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
query,
1010
orderBy,
1111
where,
12-
type DocumentData,
1312
Timestamp
1413
} from 'firebase/firestore';
1514
import type { Product, ProductAssessment } from '$lib/ai/base';

src/lib/db/firestore-products.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FirestoreProductsDB {
5252
}
5353

5454
const docRef = doc(this.getCollectionRef(), product.id);
55-
const { id, ...updateData } = product;
55+
const { id: _id, ...updateData } = product;
5656
await updateDoc(docRef, {
5757
...updateData,
5858
updatedAt: Timestamp.now()

src/routes/+layout.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import '../app.css';
33
import SkeenLogo from '$lib/assets/skeen.svg';
4+
import { resolveRoute } from '$app/paths';
45
import { page } from '$app/state';
56
import Button from '$lib/components/ui/button/button.svelte';
67
import { History, User, GitCompare, Heart, Package, LogOut, LogIn } from '@lucide/svelte';
@@ -62,7 +63,7 @@
6263
>
6364
<div class="container mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
6465
<div class="flex h-16 items-center justify-between">
65-
<a href="/" class="flex items-center text-xl font-bold">
66+
<a href={resolveRoute('/')} class="flex items-center text-xl font-bold">
6667
<!-- <Sparkles class="h-6 w-6 text-primary" /> -->
6768
<img src={SkeenLogo} alt="Skeen Logo" class="h-6 w-6" />
6869
<span class="text-2xl">keen</span>

src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import * as Dialog from '$lib/components/ui/dialog';
55
import * as Tabs from '$lib/components/ui/tabs';
66
import { Button } from '$lib/components/ui/button';
7-
import { Sparkles, AlertCircle, User, Info, Save, Search, Database } from '@lucide/svelte';
7+
import { AlertCircle, User, Info, Save, Search } from '@lucide/svelte';
88
import type { BaseAIClient, Product, ProductAssessment } from '$lib/ai/base';
99
import ImageUpload from '$lib/components/custom/image-upload.svelte';
1010
import ProductEntry from '$lib/components/custom/product-entry.svelte';

0 commit comments

Comments
 (0)