Skip to content

Commit a61413c

Browse files
committed
fix: resolve linting errors in StepConnector component
- Add empty cleanup function for consistent return in useEffect - Add comments to empty catch blocks to clarify intentional error suppression - Fix ESLint errors: consistent-return and no-empty
1 parent db00f2d commit a61413c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/components/stepConnector/index.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ export function StepComponent({
7272

7373
useEffect(() => {
7474
const container = containerRef.current;
75-
if (!container) return;
75+
if (!container) {
76+
// Return empty cleanup function for consistent return
77+
return () => {};
78+
}
7679

7780
const headings = Array.from(
7881
container.querySelectorAll<HTMLElement>(`:scope ${selector}`)
@@ -109,6 +112,7 @@ export function StepComponent({
109112
}
110113
});
111114

115+
// Cleanup function
112116
return () => {
113117
headings.forEach(h => {
114118
h.classList.remove(styles.stepHeading);
@@ -126,7 +130,9 @@ export function StepComponent({
126130
try {
127131
const raw = sessionStorage.getItem(storageKey);
128132
if (raw) setCompleted(new Set(JSON.parse(raw) as string[]));
129-
} catch {}
133+
} catch {
134+
// Ignore storage errors
135+
}
130136
// eslint-disable-next-line react-hooks/exhaustive-deps
131137
}, [storageKey, checkable]);
132138

@@ -147,7 +153,9 @@ export function StepComponent({
147153
if (storageKey && checkable) {
148154
try {
149155
sessionStorage.setItem(storageKey, JSON.stringify(Array.from(completed)));
150-
} catch {}
156+
} catch {
157+
// Ignore storage errors
158+
}
151159
}
152160
}, [completed, selector, storageKey, checkable]);
153161

@@ -156,7 +164,9 @@ export function StepComponent({
156164
if (storageKey) {
157165
try {
158166
sessionStorage.removeItem(storageKey);
159-
} catch {}
167+
} catch {
168+
// Ignore storage errors
169+
}
160170
}
161171
};
162172

0 commit comments

Comments
 (0)