fix: resolve all CI lint errors (9 errors → 0)
Web Client CI/CD / Lint (ESLint + TypeScript) (push) Successful in 40s
Web Client CI/CD / Build (tsc + Vite) (push) Failing after 36s
Web Client CI/CD / Deploy to shared hosting (push) Has been skipped

- Move SortTh outside AdminEmergencyContactIndexPage to fix
  react-hooks/static-components (5 errors)
- Fix ternary expressions used as statements in toggleSection
  and toggleDate (2 @typescript-eslint/no-unused-expressions errors)
- Remove stale eslint-disable-next-line react/no-danger comment
  referencing unregistered rule (1 error)
- Fix pre-existing any type in WiredParentScreens student.map
This commit is contained in:
root
2026-06-22 00:38:47 -04:00
parent 7282020444
commit 816f4cfaf0
5 changed files with 187 additions and 180 deletions
+26 -18
View File
@@ -37,6 +37,27 @@ type FlatContact = {
phone: string
}
type SortKey = keyof Omit<FlatContact, 'contactId' | 'parentId'>
function SortTh({ col, label, sortKey, sortDir, onSort }: {
col: SortKey
label: string
sortKey: SortKey
sortDir: 'asc' | 'desc'
onSort: (col: SortKey) => void
}) {
const active = sortKey === col
return (
<th
role="button"
style={{ cursor: 'pointer', userSelect: 'none', whiteSpace: 'nowrap' }}
onClick={() => onSort(col)}
>
{label} <span className="text-muted small">{active ? (sortDir === 'asc' ? '▲' : '▼') : '⇅'}</span>
</th>
)
}
export function AdminEmergencyContactIndexPage() {
const [groups, setGroups] = useState<EmergencyContactGroupRow[]>([])
const [error, setError] = useState<string | null>(null)
@@ -97,19 +118,6 @@ export function AdminEmergencyContactIndexPage() {
})
}, [flatRows, search, sortKey, sortDir])
function SortTh({ col, label }: { col: typeof sortKey; label: string }) {
const active = sortKey === col
return (
<th
role="button"
style={{ cursor: 'pointer', userSelect: 'none', whiteSpace: 'nowrap' }}
onClick={() => toggleSort(col)}
>
{label} <span className="text-muted small">{active ? (sortDir === 'asc' ? '▲' : '▼') : '⇅'}</span>
</th>
)
}
return (
<PageShell title="Emergency Contact Information">
{error ? <div className="alert alert-danger">{error}</div> : null}
@@ -132,11 +140,11 @@ export function AdminEmergencyContactIndexPage() {
<table className="table table-bordered table-striped align-middle">
<thead className="table-dark">
<tr>
<SortTh col="parentName" label="Parent Name" />
<SortTh col="students" label="Students" />
<SortTh col="contactName" label="Contact Name" />
<SortTh col="relation" label="Relation" />
<SortTh col="phone" label="Phone" />
<SortTh col="parentName" label="Parent Name" sortKey={sortKey} sortDir={sortDir} onSort={toggleSort} />
<SortTh col="students" label="Students" sortKey={sortKey} sortDir={sortDir} onSort={toggleSort} />
<SortTh col="contactName" label="Contact Name" sortKey={sortKey} sortDir={sortDir} onSort={toggleSort} />
<SortTh col="relation" label="Relation" sortKey={sortKey} sortDir={sortDir} onSort={toggleSort} />
<SortTh col="phone" label="Phone" sortKey={sortKey} sortDir={sortDir} onSort={toggleSort} />
<th>Actions</th>
</tr>
</thead>
+1 -1
View File
@@ -1350,7 +1350,7 @@ export function AdminClassAssignmentPage() {
function toggleSection(key: string) {
setExpandedSections((prev) => {
const next = new Set(prev)
next.has(key) ? next.delete(key) : next.add(key)
if (next.has(key)) next.delete(key); else next.add(key)
return next
})
}
@@ -116,7 +116,6 @@ export function FamilyLegacyImportPage() {
{meta?.instructions_html ? (
<div
className="small"
// eslint-disable-next-line react/no-danger -- API-provided HTML when present
dangerouslySetInnerHTML={{ __html: meta.instructions_html }}
/>
) : (
+1 -1
View File
@@ -515,7 +515,7 @@ export function ParentReportAttendancePage() {
<select name="student_id" className="form-control" required>
<option value="">Select student</option>
{Array.isArray(data?.students)
? data.students.map((student: any) => (
? data.students.map((student: { id: number; firstname: string; lastname: string }) => (
<option key={student.id} value={student.id}>
{student.firstname} {student.lastname}
</option>
+1 -1
View File
@@ -113,7 +113,7 @@ export function SlipPreviewListPage() {
function toggleDate(dateKey: string) {
setExpandedDates((prev) => {
const next = new Set(prev)
next.has(dateKey) ? next.delete(dateKey) : next.add(dateKey)
if (next.has(dateKey)) next.delete(dateKey); else next.add(dateKey)
return next
})
}