diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js
index 4165d8d0..647ee808 100644
--- a/frontend/eslint.config.js
+++ b/frontend/eslint.config.js
@@ -65,6 +65,7 @@ export default [
jest: "readonly",
test: "readonly",
global: "readonly",
+ console: "readonly",
},
},
rules: {
diff --git a/frontend/src/__tests__/components/BookingForm.test.tsx b/frontend/src/__tests__/components/BookingForm.test.tsx
index a95e8543..7f7bbfac 100644
--- a/frontend/src/__tests__/components/BookingForm.test.tsx
+++ b/frontend/src/__tests__/components/BookingForm.test.tsx
@@ -37,10 +37,9 @@ describe("BookingForm", () => {
dispatchEvent() {
return true;
}
- onmessage: ((this: EventSource, ev: MessageEvent) => unknown) | null =
- null;
- onerror: ((this: EventSource, ev: Event) => unknown) | null = null;
- onopen: ((this: EventSource, ev: Event) => unknown) | null = null;
+ onmessage: (() => unknown) | null = null;
+ onerror: (() => unknown) | null = null;
+ onopen: (() => unknown) | null = null;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.EventSource = EventSourceMock as any;
diff --git a/frontend/src/__tests__/components/RoomSelect.test.tsx b/frontend/src/__tests__/components/RoomSelect.test.tsx
index fff12cbc..eaecd083 100644
--- a/frontend/src/__tests__/components/RoomSelect.test.tsx
+++ b/frontend/src/__tests__/components/RoomSelect.test.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import { render, screen, fireEvent } from "@testing-library/react";
+import { render, screen } from "@testing-library/react";
import RoomSelect from "../../components/RoomSelect";
describe("RoomSelect", () => {
@@ -9,10 +9,10 @@ describe("RoomSelect", () => {
});
it("calls onChange when a room is selected", () => {
- const onChange = jest.fn();
- render();
+ const _onChange = jest.fn();
+ render();
// Simulate selection change if options exist
// fireEvent.change(screen.getByLabelText(/room/i), { target: { value: "2" } });
- // expect(onChange).toHaveBeenCalledWith("2");
+ // expect(_onChange).toHaveBeenCalledWith("2");
});
});
diff --git a/frontend/src/__tests__/pages/BookingPage.test.tsx b/frontend/src/__tests__/pages/BookingPage.test.tsx
index 5f0f210f..6d3efa5d 100644
--- a/frontend/src/__tests__/pages/BookingPage.test.tsx
+++ b/frontend/src/__tests__/pages/BookingPage.test.tsx
@@ -38,10 +38,9 @@ describe("BookingPage", () => {
dispatchEvent() {
return true;
}
- onmessage: ((this: EventSource, ev: MessageEvent) => unknown) | null =
- null;
- onerror: ((this: EventSource, ev: Event) => unknown) | null = null;
- onopen: ((this: EventSource, ev: Event) => unknown) | null = null;
+ onmessage: (() => unknown) | null = null;
+ onerror: (() => unknown) | null = null;
+ onopen: (() => unknown) | null = null;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.EventSource = EventSourceMock as any;
diff --git a/frontend/src/__tests__/pages/ConfirmationPage.test.tsx b/frontend/src/__tests__/pages/ConfirmationPage.test.tsx
index 89a3dcf4..866d191b 100644
--- a/frontend/src/__tests__/pages/ConfirmationPage.test.tsx
+++ b/frontend/src/__tests__/pages/ConfirmationPage.test.tsx
@@ -37,10 +37,9 @@ describe("ConfirmationPage", () => {
dispatchEvent() {
return true;
}
- onmessage: ((this: EventSource, ev: MessageEvent) => unknown) | null =
- null;
- onerror: ((this: EventSource, ev: Event) => unknown) | null = null;
- onopen: ((this: EventSource, ev: Event) => unknown) | null = null;
+ onmessage: (() => unknown) | null = null;
+ onerror: (() => unknown) | null = null;
+ onopen: (() => unknown) | null = null;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.EventSource = EventSourceMock as any;
diff --git a/frontend/src/__tests__/pages/LandingPage.test.tsx b/frontend/src/__tests__/pages/LandingPage.test.tsx
index c2b075a7..31cde570 100644
--- a/frontend/src/__tests__/pages/LandingPage.test.tsx
+++ b/frontend/src/__tests__/pages/LandingPage.test.tsx
@@ -39,10 +39,9 @@ describe("LandingPage", () => {
dispatchEvent() {
return true;
}
- onmessage: ((this: EventSource, ev: MessageEvent) => unknown) | null =
- null;
- onerror: ((this: EventSource, ev: Event) => unknown) | null = null;
- onopen: ((this: EventSource, ev: Event) => unknown) | null = null;
+ onmessage: (() => unknown) | null = null;
+ onerror: (() => unknown) | null = null;
+ onopen: (() => unknown) | null = null;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.EventSource = EventSourceMock as any;
diff --git a/frontend/src/apis/sse.ts b/frontend/src/apis/sse.ts
index b10d1c7f..a2eb6cf2 100644
--- a/frontend/src/apis/sse.ts
+++ b/frontend/src/apis/sse.ts
@@ -25,7 +25,9 @@ export function connectRoomsAvailabilityStream({
onError,
}: {
url?: string;
+ /* eslint-disable-next-line no-unused-vars */
onMessage: (data: RoomsAvailabilitySSEPayload) => void;
+ /* eslint-disable-next-line no-unused-vars */
onError?: (error: unknown) => void;
}) {
const es = new window.EventSource(url);
@@ -34,12 +36,16 @@ export function connectRoomsAvailabilityStream({
const data: RoomsAvailabilitySSEPayload = JSON.parse(event.data);
onMessage(data);
} catch (e) {
- if (onError) onError(e);
+ if (onError) {
+ onError(e);
+ }
}
};
es.onerror = (err) => {
es.close();
- if (onError) onError(err);
+ if (onError) {
+ onError(err);
+ }
};
return es;
}
diff --git a/frontend/src/components/BookingConfirmation.tsx b/frontend/src/components/BookingConfirmation.tsx
index 4e781358..ec27b0ea 100644
--- a/frontend/src/components/BookingConfirmation.tsx
+++ b/frontend/src/components/BookingConfirmation.tsx
@@ -32,7 +32,9 @@ const BookingConfirmation: React.FC = ({
onEdit,
onBack,
}) => {
- if (!booking) return null;
+ if (!booking) {
+ return null;
+ }
const { room, start_time, end_time, title, invitees } = booking;
return (
void;
editBooking?: Booking;
slotInfo?: { room_id?: string | number; start?: string };
- onBookingSuccess?: (booking?: Booking) => void;
+ onBookingSuccess?: () => void;
}
const BookingForm: React.FC = ({
@@ -97,9 +97,15 @@ const BookingForm: React.FC = ({
// Room selection
const initialRoomId = useMemo(() => {
- if (isEdit && editBooking) return getEditBookingRoomId(editBooking);
- if (slotInfo?.room_id) return String(slotInfo.room_id);
- if (rooms.length > 0) return String((rooms[0] as ConferenceRoom).id);
+ if (isEdit && editBooking) {
+ return getEditBookingRoomId(editBooking);
+ }
+ if (slotInfo?.room_id) {
+ return String(slotInfo.room_id);
+ }
+ if (rooms.length > 0) {
+ return String((rooms[0] as ConferenceRoom).id);
+ }
return "";
}, [isEdit, editBooking, slotInfo, rooms]);
const [room_id, setRoomId] = useState(initialRoomId);
@@ -138,13 +144,17 @@ const BookingForm: React.FC = ({
const currentCandidate = candidate;
const currentCandidateEnd = candidateEnd;
const overlaps = roomBookings.some(function (b) {
- if (isEdit && b.id === editBooking?.id) return false;
+ if (isEdit && b.id === editBooking?.id) {
+ return false;
+ }
return (
currentCandidate < new Date(b.end_time) &&
currentCandidateEnd > new Date(b.start_time)
);
});
- if (!overlaps && candidate > now) return candidate;
+ if (!overlaps && candidate > now) {
+ return candidate;
+ }
candidate = candidateEnd;
}
return candidate;
@@ -153,10 +163,12 @@ const BookingForm: React.FC = ({
);
const initialStart = useMemo(() => {
- if (isEdit && editBooking?.start_time)
+ if (isEdit && editBooking?.start_time) {
return new Date(editBooking.start_time);
- if (slotInfo?.start)
+ }
+ if (slotInfo?.start) {
return findNextAvailableStart(room_id, new Date(slotInfo.start));
+ }
return findNextAvailableStart(room_id, now);
}, [isEdit, editBooking, slotInfo, room_id, findNextAvailableStart, now]);
const [start, setStart] = useState(initialStart.toISOString());
@@ -164,7 +176,9 @@ const BookingForm: React.FC = ({
// End time
const [customInterval, setCustomInterval] = useState(null);
const initialEnd = useMemo(() => {
- if (isEdit && editBooking?.end_time) return new Date(editBooking.end_time);
+ if (isEdit && editBooking?.end_time) {
+ return new Date(editBooking.end_time);
+ }
return new Date(
initialStart.getTime() + ENV.DEFAULT_BOOKING_INTERVAL_MINUTES * 60000
);
@@ -179,19 +193,27 @@ const BookingForm: React.FC = ({
const newErrors: { [key: string]: string } = {};
// Room
const roomIdError = validateRoomId(room_id);
- if (roomIdError) newErrors.room_id = roomIdError;
+ if (roomIdError) {
+ newErrors.room_id = roomIdError;
+ }
// Start
const startError = validateStart(start);
- if (startError) newErrors.start = startError;
+ if (startError) {
+ newErrors.start = startError;
+ }
// End
const endError = validateEnd(end, start);
- if (endError) newErrors.end = endError;
+ if (endError) {
+ newErrors.end = endError;
+ }
// Overlap
const roomBookings = bookings.filter(
(b: Booking) => String(b.room_id) === String(room_id)
);
const overlaps = roomBookings.some((b: Booking) => {
- if (isEdit && b.id === editBooking?.id) return false;
+ if (isEdit && b.id === editBooking?.id) {
+ return false;
+ }
return (
new Date(start) < new Date(b.end_time) &&
new Date(end) > new Date(b.start_time)
@@ -203,7 +225,9 @@ const BookingForm: React.FC = ({
}
// Invitees
const inviteesError = validateInvitees(invitees, roomCapacity);
- if (inviteesError) newErrors.invitees = inviteesError;
+ if (inviteesError) {
+ newErrors.invitees = inviteesError;
+ }
setErrors(newErrors);
return Object.keys(newErrors).length === 0;
}
@@ -224,7 +248,9 @@ const BookingForm: React.FC = ({
setEnd(value);
const interval =
(new Date(value).getTime() - new Date(start).getTime()) / 60000;
- if (interval > 0) setCustomInterval(interval);
+ if (interval > 0) {
+ setCustomInterval(interval);
+ }
validateFields();
}
function handleInviteeChange(event: SelectChangeEvent) {
@@ -245,7 +271,9 @@ const BookingForm: React.FC = ({
onClose();
return;
}
- if (!validateFields()) return;
+ if (!validateFields()) {
+ return;
+ }
try {
let bookingResult;
if (!isEdit) {
@@ -269,9 +297,11 @@ const BookingForm: React.FC = ({
logger.info("[BookingForm] updateBooking payload:", updatePayload);
bookingResult = await updateBooking(editBooking.id, updatePayload);
}
- if (onBookingSuccess && bookingResult) onBookingSuccess(bookingResult);
+ if (onBookingSuccess && bookingResult) {
+ onBookingSuccess(bookingResult);
+ }
onClose();
- } catch (err: any) {
+ } catch (err: unknown) {
let errorMsg = "Failed to save booking. Please try again.";
if (err?.response?.data?.detail) {
errorMsg = err.response.data.detail;
@@ -308,7 +338,7 @@ const BookingForm: React.FC = ({
- handleRoomChange({ target: { value: id } } as any)
+ handleRoomChange({ target: { value: id } } as unknown)
}
label="Room"
minWidth={180}
@@ -332,9 +362,13 @@ const BookingForm: React.FC = ({
label="Start Time"
type="datetime-local"
value={(() => {
- if (!start) return "";
+ if (!start) {
+ return "";
+ }
const d = new Date(start);
- if (isNaN(d.getTime())) return "";
+ if (isNaN(d.getTime())) {
+ return "";
+ }
const pad = (n: number) => n.toString().padStart(2, "0");
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(
d.getDate()
@@ -356,9 +390,13 @@ const BookingForm: React.FC = ({
label="End Time"
type="datetime-local"
value={(() => {
- if (!end) return "";
+ if (!end) {
+ return "";
+ }
const d = new Date(end);
- if (isNaN(d.getTime())) return "";
+ if (isNaN(d.getTime())) {
+ return "";
+ }
const pad = (n: number) => n.toString().padStart(2, "0");
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(
d.getDate()
@@ -387,7 +425,9 @@ const BookingForm: React.FC = ({
renderValue={(selected) => (
{(selected as string[]).map((value, idx) => {
- const user = users.find((u: any) => u.email === value);
+ const user = users.find(
+ (u: import("../interfaces").User) => u.email === value
+ );
return (
= ({
} left`
: `${Math.abs(remainingSlots)} over room capacity`}
- {users.map((user: any) => {
+ {users.map((user: import("../interfaces").User) => {
const email = user.email ?? user.name;
const isSelected = invitees.includes(email);
// User unavailable if booked for another event at this time
const unavailable = bookings.some((b: Booking) => {
- if (isEdit && b.id === editBooking?.id) return false;
+ if (isEdit && b.id === editBooking?.id) {
+ return false;
+ }
return (
b.invitees?.includes(email) &&
new Date(start) < new Date(b.end_time) &&
@@ -486,9 +528,11 @@ const BookingForm: React.FC = ({
if (editBooking) {
try {
await deleteBooking(editBooking.id);
- if (onBookingSuccess) onBookingSuccess();
+ if (onBookingSuccess) {
+ onBookingSuccess();
+ }
onClose();
- } catch (err: any) {
+ } catch (err: unknown) {
let errorMsg =
"Failed to delete booking. Please try again.";
if (err?.response?.data?.detail) {
diff --git a/frontend/src/components/RoomDetailsModal.tsx b/frontend/src/components/RoomDetailsModal.tsx
index 7911a4ef..9bca6b15 100644
--- a/frontend/src/components/RoomDetailsModal.tsx
+++ b/frontend/src/components/RoomDetailsModal.tsx
@@ -32,7 +32,9 @@ const RoomDetailsModal: React.FC = ({
room,
}) => {
// Lifecycle and debug logging removed
- if (!room) return null;
+ if (!room) {
+ return null;
+ }
return (