fix: repair tsc/lint breakage introduced across Tasks 6, 11-13
Two independent plan gaps, both surfaced only now because no prior task
in this plan ran a full tsc/lint pass (only scoped vitest per task):
1. Task 6 added required featured/featuredOrder fields to the Product
type but only updated products.test.ts's fixture. ProductCard.test.tsx
and InquiryModal.test.tsx also construct Product-typed fixtures and
were never updated, breaking `tsc -b`/`npm run build`.
2. Tasks 11-13's plan text called the extracted load*() function
directly from a bare `useEffect(() => { void load*() }, [])`, which
trips this repo's react-hooks/set-state-in-effect rule. This
project's established convention (already used in AdminSchedule.tsx)
wraps the call in an effect-local inner async function instead.
Claude-Session: https://claude.ai/code/session_01NhxA4npAXAxmCDEJt6kxSH
This commit is contained in:
@@ -15,6 +15,7 @@ import type { Product } from '../data/products'
|
||||
const product: Product = {
|
||||
id: 'edge-control', name: 'Silk Edge Control', category: 'hair-care',
|
||||
price: 12, image: '/x.jpg', description: 'Hold with shine.', inStock: true,
|
||||
featured: false, featuredOrder: null,
|
||||
}
|
||||
|
||||
describe('InquiryModal', () => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { Product } from '../data/products'
|
||||
const product: Product = {
|
||||
id: 'edge-control', name: 'Silk Edge Control', category: 'hair-care',
|
||||
price: 12, image: '/x.jpg', description: 'Hold with shine.', inStock: true,
|
||||
featured: false, featuredOrder: null,
|
||||
}
|
||||
|
||||
describe('ProductCard', () => {
|
||||
|
||||
@@ -46,7 +46,10 @@ function AdminProducts() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
void loadProducts()
|
||||
async function load() {
|
||||
await loadProducts()
|
||||
}
|
||||
void load()
|
||||
}, [])
|
||||
|
||||
async function handleSubmit(event: FormEvent) {
|
||||
|
||||
@@ -42,7 +42,10 @@ function AdminRules() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
void loadRules()
|
||||
async function load() {
|
||||
await loadRules()
|
||||
}
|
||||
void load()
|
||||
}, [])
|
||||
|
||||
async function handleSubmit(event: FormEvent) {
|
||||
|
||||
@@ -34,7 +34,10 @@ function AdminTestimonials() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
void loadTestimonials()
|
||||
async function load() {
|
||||
await loadTestimonials()
|
||||
}
|
||||
void load()
|
||||
}, [])
|
||||
|
||||
async function handleSubmit(event: FormEvent) {
|
||||
|
||||
Reference in New Issue
Block a user