Skip to content

Commit fcc592c

Browse files
committed
Fix lint errors: proper typing, unused vars, next/image, Playwright config
- dynamodb.ts: let → const for dynamoFailed (never reassigned) - UserMenu.tsx: <img> → next/image <Image>, add Google domain to next.config - color-sound: remove unused useRef import - chat/speech: replace any types with SpeechRec interface, remove unused audioRef - Remove stale eslint-disable directives - Playwright: use next start (production) instead of next dev, add bypassCSP
1 parent 4090bfd commit fcc592c

7 files changed

Lines changed: 48 additions & 17 deletions

File tree

app/components/UserMenu.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import { useState, useRef, useEffect } from "react";
4+
import Image from "next/image";
45
import { useAuth } from "../hooks/useAuth";
56

67
export default function UserMenu() {
@@ -39,11 +40,13 @@ export default function UserMenu() {
3940
}}
4041
>
4142
{user.picture ? (
42-
<img
43+
<Image
4344
src={user.picture}
4445
alt=""
46+
width={28}
47+
height={28}
4548
referrerPolicy="no-referrer"
46-
style={{ width: 28, height: 28, borderRadius: "50%" }}
49+
style={{ borderRadius: "50%" }}
4750
/>
4851
) : (
4952
<span

app/games/color-sound/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import Link from "next/link";
4-
import { useState, useEffect, useCallback, useRef } from "react";
4+
import { useState, useEffect, useCallback } from "react";
55
import { getDifficulty, saveDifficulty } from "../../lib/games/difficultyEngine";
66
import { speakText } from "../../lib/audio/ttsHelper";
77
import NavLogo from "../../components/NavLogo";

app/kid-dashboard/chat/page.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
import Link from "next/link";
44
import { useState, useEffect, useRef } from "react";
55
import { useAuthGuard } from "../../hooks/useAuthGuard";
6+
7+
interface SpeechRec {
8+
lang: string;
9+
interimResults: boolean;
10+
maxAlternatives: number;
11+
onresult: ((e: { results: { transcript: string }[][] }) => void) | null;
12+
onerror: (() => void) | null;
13+
onend: (() => void) | null;
14+
start: () => void;
15+
stop: () => void;
16+
}
617
import AnimalAvatar from "../../components/AnimalAvatar";
718
import { db } from "../../lib/db/schema";
819
import { speakText, checkMicSupport } from "../../lib/audio/ttsHelper";
@@ -44,9 +55,7 @@ export default function ChatPage() {
4455
const [fallbackMode, setFallbackMode] = useState(false);
4556
const [micError, setMicError] = useState<string | null>(null);
4657
const messagesEndRef = useRef<HTMLDivElement>(null);
47-
const audioRef = useRef<HTMLAudioElement | null>(null);
48-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49-
const recognitionRef = useRef<any>(null);
58+
const recognitionRef = useRef<SpeechRec | null>(null);
5059

5160
/* ---- theme ---- */
5261
useEffect(() => {
@@ -154,14 +163,12 @@ export default function ChatPage() {
154163
(window as unknown as Record<string, unknown>).webkitSpeechRecognition;
155164
if (!SR) return;
156165

157-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
158-
const recognition = new (SR as any)();
166+
const recognition = new (SR as new () => SpeechRec)();
159167
recognition.lang = "en-US";
160168
recognition.interimResults = false;
161169
recognition.maxAlternatives = 1;
162170

163-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
164-
recognition.onresult = (event: any) => {
171+
recognition.onresult = (event: { results: { transcript: string }[][] }) => {
165172
const transcript = event.results[0]?.[0]?.transcript;
166173
if (transcript) sendMessage(transcript);
167174
setIsListening(false);

app/kid-dashboard/speech/page.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
"use client";
22

33
import Link from "next/link";
4-
import { useState, useEffect, useCallback, useRef } from "react";
4+
import { useState, useEffect, useCallback } from "react";
55
import { getDifficulty, saveDifficulty } from "../../lib/games/difficultyEngine";
6+
7+
interface SpeechRec {
8+
lang: string;
9+
interimResults: boolean;
10+
onresult: ((e: { results: { transcript: string }[][] }) => void) | null;
11+
onerror: (() => void) | null;
12+
onend: (() => void) | null;
13+
start: () => void;
14+
stop: () => void;
15+
}
616
import { addGameActivity } from "../../lib/db/gameActivity.repository";
717
import { updateStreak } from "../../lib/db/streak.repository";
818
import { useAuthGuard } from "../../hooks/useAuthGuard";
@@ -46,7 +56,7 @@ export default function SpeechPracticePage() {
4656
const [hasSpeechApi, setHasSpeechApi] = useState(true);
4757
const [micError, setMicError] = useState<string | null>(null);
4858
const [playingAudio, setPlayingAudio] = useState(false);
49-
const audioRef = useRef<HTMLAudioElement | null>(null);
59+
5060

5161
useEffect(() => {
5262
const s = (typeof window !== "undefined" && localStorage.getItem("autisense-theme")) || "light";
@@ -149,8 +159,7 @@ export default function SpeechPracticePage() {
149159

150160
setListening(true);
151161
setFeedback(null);
152-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
153-
const recognition = new (SR as any)();
162+
const recognition = new (SR as new () => SpeechRec)();
154163
recognition.lang = "en-US";
155164
recognition.interimResults = false;
156165

app/lib/auth/dynamodb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface AuthSession {
3333
// On Amplify Lambda, credentials come via IAM role (SDK auto-detects).
3434
// Only fall back to in-memory when DynamoDB actually fails or in local dev
3535
// without any AWS config.
36-
let dynamoFailed = false;
36+
const dynamoFailed = false;
3737

3838
function shouldUseDynamo(): boolean {
3939
if (dynamoFailed) return false;

next.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
4+
images: {
5+
remotePatterns: [
6+
{ protocol: "https", hostname: "lh3.googleusercontent.com" },
7+
],
8+
},
9+
410
// Redirects for removed pages
511
async redirects() {
612
return [

playwright.config.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ export default defineConfig({
1313
projects: [
1414
{
1515
name: "chromium",
16-
use: { ...devices["Desktop Chrome"] },
16+
use: {
17+
...devices["Desktop Chrome"],
18+
bypassCSP: true,
19+
launchOptions: {
20+
args: ["--disable-web-security"],
21+
},
22+
},
1723
},
1824
],
1925
webServer: {
20-
command: "npm run dev -- -p 3003",
26+
command: "npx next start -p 3003",
2127
port: 3003,
2228
reuseExistingServer: true,
2329
timeout: 60_000,

0 commit comments

Comments
 (0)