fix(lint): תיקון 10 שגיאות ESLint + ניקוי directives מיותרים #60

Merged
chaim merged 1 commits from fix/lint-errors into main 2026-06-06 13:32:46 +00:00
11 changed files with 15 additions and 12 deletions
Showing only changes of commit 1f1a025509 - Show all commits

View File

@@ -107,8 +107,10 @@ function DocumentPreviewDialog({
useEffect(() => { useEffect(() => {
if (!open) { if (!open) {
/* eslint-disable react-hooks/set-state-in-effect -- reset on close */
setText(null); setText(null);
setError(null); setError(null);
/* eslint-enable react-hooks/set-state-in-effect */
return; return;
} }
let cancelled = false; let cancelled = false;

View File

@@ -203,7 +203,7 @@ export function LegalArgumentsPanel({ caseNumber }: LegalArgumentsPanelProps) {
</p> </p>
) : !data?.total ? ( ) : !data?.total ? (
<p className="text-ink-muted text-sm"> <p className="text-ink-muted text-sm">
אין טיעונים מאוגדים עדיין. לחץ "חשב טיעונים" כדי להריץ את ה-aggregator. אין טיעונים מאוגדים עדיין. לחץ &ldquo;חשב טיעונים&rdquo; כדי להריץ את ה-aggregator.
</p> </p>
) : ( ) : (
<div className="space-y-6"> <div className="space-y-6">

View File

@@ -34,6 +34,7 @@ export function ChairEditor({
/* Reset when the upstream analysis refetches (e.g. after initial load) */ /* Reset when the upstream analysis refetches (e.g. after initial load) */
useEffect(() => { useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect -- sync from server
setValue(initialValue); setValue(initialValue);
lastSaved.current = initialValue; lastSaved.current = initialValue;
}, [initialValue]); }, [initialValue]);

View File

@@ -49,6 +49,7 @@ export function ContentChecklistsPanel() {
useEffect(() => { useEffect(() => {
if (!data?.items) return; if (!data?.items) return;
// eslint-disable-next-line react-hooks/set-state-in-effect -- sync from server
setItems( setItems(
CHECKLIST_ORDER CHECKLIST_ORDER
.filter((k) => k in data.items) .filter((k) => k in data.items)

View File

@@ -40,6 +40,7 @@ export function DiscussionRulesPanel() {
useEffect(() => { useEffect(() => {
if (!data?.items) return; if (!data?.items) return;
const order = ["universal", "rejection", "partial_acceptance", "full_acceptance", "betterment_levy"]; const order = ["universal", "rejection", "partial_acceptance", "full_acceptance", "betterment_levy"];
// eslint-disable-next-line react-hooks/set-state-in-effect -- sync from server
setSections( setSections(
order order
.filter((k) => k in data.items) .filter((k) => k in data.items)

View File

@@ -46,6 +46,7 @@ export function GoldenRatiosPanel() {
// Sync from server // Sync from server
useEffect(() => { useEffect(() => {
if (!data?.items) return; if (!data?.items) return;
// eslint-disable-next-line react-hooks/set-state-in-effect -- sync from server
setCards( setCards(
Object.entries(data.items).map(([key, item]) => ({ Object.entries(data.items).map(([key, item]) => ({
key, key,

View File

@@ -474,7 +474,6 @@ function PendingPanel() {
useEffect(() => { useEffect(() => {
if (focusedId === null) return; if (focusedId === null) return;
if (visibleItems.some((h) => h.id === focusedId)) return; if (visibleItems.some((h) => h.id === focusedId)) return;
// eslint-disable-next-line react-hooks/set-state-in-effect
setFocusedId(visibleItems[0]?.id ?? null); setFocusedId(visibleItems[0]?.id ?? null);
}, [focusedId, visibleItems]); }, [focusedId, visibleItems]);

View File

@@ -239,7 +239,7 @@ export function PrecedentEditSheet({ caseLawId, onOpenChange }: Props) {
</Select> </Select>
</div> </div>
<div className="space-y-1"> <div className="space-y-1">
<Label htmlFor="chair-name">יו"ר</Label> <Label htmlFor="chair-name">יו&quot;ר</Label>
<Input id="chair-name" value={form.chair_name} <Input id="chair-name" value={form.chair_name}
onChange={(e) => setForm({ ...form, chair_name: e.target.value })} onChange={(e) => setForm({ ...form, chair_name: e.target.value })}
placeholder="" /> placeholder="" />

View File

@@ -75,15 +75,11 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
useEffect(() => { useEffect(() => {
if (open) return; if (open) return;
// eslint-disable-next-line react-hooks/set-state-in-effect // eslint-disable-next-line react-hooks/set-state-in-effect -- reset form on close
setFile(null); setCitation(""); setCaseName(""); setCourt(""); setFile(null); setCitation(""); setCaseName(""); setCourt("");
// eslint-disable-next-line react-hooks/set-state-in-effect
setDecisionDate(""); setSourceType(""); setPrecedentLevel(""); setDecisionDate(""); setSourceType(""); setPrecedentLevel("");
// eslint-disable-next-line react-hooks/set-state-in-effect
setPracticeArea(""); setAppealSubtype(""); setSubjectTags(""); setPracticeArea(""); setAppealSubtype(""); setSubjectTags("");
// eslint-disable-next-line react-hooks/set-state-in-effect
setHeadnote(""); setIsBinding(true); setTaskId(null); setConflict(null); setHeadnote(""); setIsBinding(true); setTaskId(null); setConflict(null);
// eslint-disable-next-line react-hooks/set-state-in-effect
setChairName(""); setDistrict(""); setCaseNumber(""); setChairName(""); setDistrict(""); setCaseNumber("");
}, [open]); }, [open]);

View File

@@ -25,11 +25,12 @@ export function SubjectDonut({
segments: Array<{ label: string; count: number }>; segments: Array<{ label: string; count: number }>;
total: number; total: number;
}) { }) {
let pct = 0; // Prefix sums without a mutable outer accumulator (React Compiler rejects
// reassigning a let after render). segments is tiny, so O(n²) is fine.
const parts = segments.map((s, i) => { const parts = segments.map((s, i) => {
const start = total === 0 ? 0 : (pct / total) * 360; const before = segments.slice(0, i).reduce((acc, x) => acc + x.count, 0);
pct += s.count; const start = total === 0 ? 0 : (before / total) * 360;
const end = total === 0 ? 360 : (pct / total) * 360; const end = total === 0 ? 360 : ((before + s.count) / total) * 360;
return { ...s, start, end, color: DONUT_COLORS[i % DONUT_COLORS.length] }; return { ...s, start, end, color: DONUT_COLORS[i % DONUT_COLORS.length] };
}); });

View File

@@ -217,6 +217,7 @@ export function useProgress(taskId: string | null, caseNumber?: string) {
useEffect(() => { useEffect(() => {
if (!taskId) return; if (!taskId) return;
// eslint-disable-next-line react-hooks/set-state-in-effect -- reset on taskId change
setEvent(null); setEvent(null);
/* Self-heal fallback: if no SSE message arrives within 10s — usually /* Self-heal fallback: if no SSE message arrives within 10s — usually