From 2593b371d5b59d6dc3eeed3f8ce61c639db80c90 Mon Sep 17 00:00:00 2001 From: doprz <52579214+doprz@users.noreply.github.com> Date: Tue, 5 Mar 2024 23:06:12 -0600 Subject: [PATCH] chore: lint and format repo - 1 lint error left --- src/stories/components/CourseCellColorPicker.stories.tsx | 3 ++- src/views/components/common/Button/Button.tsx | 1 - .../common/CourseCellColorPicker/CourseCellColorPicker.tsx | 3 ++- src/views/components/common/InfoCard/InfoCard.tsx | 2 +- src/views/hooks/useFlattenedCourseSchedule.ts | 4 ++-- src/views/hooks/useSchedules.ts | 7 ++++++- src/views/lib/CourseCatalogScraper.ts | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/stories/components/CourseCellColorPicker.stories.tsx b/src/stories/components/CourseCellColorPicker.stories.tsx index b236ace8..464e357b 100644 --- a/src/stories/components/CourseCellColorPicker.stories.tsx +++ b/src/stories/components/CourseCellColorPicker.stories.tsx @@ -1,7 +1,7 @@ +import type { ThemeColor } from '@shared/util/themeColors'; import type { Meta, StoryObj } from '@storybook/react'; import CourseCellColorPicker from '@views/components/common/CourseCellColorPicker/CourseCellColorPicker'; import React, { useState } from 'react'; -import type { ThemeColor } from 'src/shared/util/themeColors'; const meta = { title: 'Components/Common/CourseCellColorPicker', @@ -13,6 +13,7 @@ type Story = StoryObj; export const Default: Story = { render: () => { + // TODO const [selectedColor, setSelectedColor] = useState(null); return ; }, diff --git a/src/views/components/common/Button/Button.tsx b/src/views/components/common/Button/Button.tsx index b843acd2..ddab9758 100644 --- a/src/views/components/common/Button/Button.tsx +++ b/src/views/components/common/Button/Button.tsx @@ -3,7 +3,6 @@ import { getThemeColorHexByName, getThemeColorRgbByName } from '@shared/util/the import Text from '@views/components/common/Text/Text'; import clsx from 'clsx'; import React from 'react'; -import { satisfies } from 'semver'; import type IconComponent from '~icons/material-symbols'; diff --git a/src/views/components/common/CourseCellColorPicker/CourseCellColorPicker.tsx b/src/views/components/common/CourseCellColorPicker/CourseCellColorPicker.tsx index 33b16bad..893fffab 100644 --- a/src/views/components/common/CourseCellColorPicker/CourseCellColorPicker.tsx +++ b/src/views/components/common/CourseCellColorPicker/CourseCellColorPicker.tsx @@ -388,4 +388,5 @@ export default function CourseCellColorPicker({ /> )} -} \ No newline at end of file + ); +} diff --git a/src/views/components/common/InfoCard/InfoCard.tsx b/src/views/components/common/InfoCard/InfoCard.tsx index ea472a74..446ded6a 100644 --- a/src/views/components/common/InfoCard/InfoCard.tsx +++ b/src/views/components/common/InfoCard/InfoCard.tsx @@ -12,7 +12,7 @@ interface Props { */ export default function InfoCard({ titleText, bodyText }: React.PropsWithChildren): JSX.Element { return ( -
+
{titleText} diff --git a/src/views/hooks/useFlattenedCourseSchedule.ts b/src/views/hooks/useFlattenedCourseSchedule.ts index 814d93a3..b8e80b52 100644 --- a/src/views/hooks/useFlattenedCourseSchedule.ts +++ b/src/views/hooks/useFlattenedCourseSchedule.ts @@ -5,13 +5,13 @@ import type { CalendarCourseCellProps } from '@views/components/calendar/Calenda import useSchedules from './useSchedules'; -const dayToNumber: { [day: string]: number } = { +const dayToNumber = { Monday: 0, Tuesday: 1, Wednesday: 2, Thursday: 3, Friday: 4, -}; +} as const satisfies Record; interface CalendarGridPoint { dayIndex: number; diff --git a/src/views/hooks/useSchedules.ts b/src/views/hooks/useSchedules.ts index 818ac4d3..971ab08e 100644 --- a/src/views/hooks/useSchedules.ts +++ b/src/views/hooks/useSchedules.ts @@ -47,7 +47,12 @@ export default function useSchedules(): [active: UserSchedule | null, schedules: return [activeSchedule, schedules]; } -export async function switchSchedule(name: string) { +/** + * Switches the active schedule to the one with the specified name. + * @param name - The name of the schedule to switch to. + * @returns A promise that resolves when the active schedule has been switched. + */ +export async function switchSchedule(name: string): Promise { const schedules = await UserScheduleStore.get('schedules'); const activeIndex = schedules.findIndex(s => s.name === name); await UserScheduleStore.set('activeIndex', activeIndex); diff --git a/src/views/lib/CourseCatalogScraper.ts b/src/views/lib/CourseCatalogScraper.ts index 046ce57f..fce12ad2 100644 --- a/src/views/lib/CourseCatalogScraper.ts +++ b/src/views/lib/CourseCatalogScraper.ts @@ -18,7 +18,7 @@ const TableDataSelector = { SCHEDULE_HOURS: 'td[data-th="Hour"]>span', SCHEDULE_LOCATION: 'td[data-th="Room"]>span', FLAGS: 'td[data-th="Flags"] ul li', -} as const; +} as const satisfies Record; type TableDataSelectorType = (typeof TableDataSelector)[keyof typeof TableDataSelector];