chore: lint-format-docs-tests-bugfixes (#105)
* docs: add jsdoc * feat: change enums to as const objects * chore(test): add themeColors.test.ts * fix: fix tests and bugs with strings.ts util * fix: path alias imports and tsconfig file bug * fix: remove --max-warnings 0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { BACKGROUND_MESSAGES } from '@shared/messages';
|
||||
import type { BACKGROUND_MESSAGES } from '@shared/messages';
|
||||
import { MessageListener } from 'chrome-extension-toolkit';
|
||||
|
||||
import onInstall from './events/onInstall';
|
||||
import onServiceWorkerAlive from './events/onServiceWorkerAlive';
|
||||
import onUpdate from './events/onUpdate';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import BrowserActionMessages from '@shared/messages/BrowserActionMessages';
|
||||
import { MessageHandler } from 'chrome-extension-toolkit';
|
||||
import type BrowserActionMessages from '@shared/messages/BrowserActionMessages';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const browserActionHandler: MessageHandler<BrowserActionMessages> = {
|
||||
disableBrowserAction({ sender, sendResponse }) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import HotReloadingMessages from '@shared/messages/HotReloadingMessages';
|
||||
import type HotReloadingMessages from '@shared/messages/HotReloadingMessages';
|
||||
import { DevStore } from '@shared/storage/DevStore';
|
||||
import { MessageHandler } from 'chrome-extension-toolkit';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const hotReloadingHandler: MessageHandler<HotReloadingMessages> = {
|
||||
async reloadExtension({ sendResponse }) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import TabManagementMessages from '@shared/messages/TabManagementMessages';
|
||||
import { MessageHandler } from 'chrome-extension-toolkit';
|
||||
import type TabManagementMessages from '@shared/messages/TabManagementMessages';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
import openNewTab from '../util/openNewTab';
|
||||
|
||||
const tabManagementHandler: MessageHandler<TabManagementMessages> = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { UserScheduleMessages } from '@shared/messages/UserScheduleMessages';
|
||||
import type { UserScheduleMessages } from '@shared/messages/UserScheduleMessages';
|
||||
import { Course } from '@shared/types/Course';
|
||||
import { MessageHandler } from 'chrome-extension-toolkit';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
import addCourse from '../lib/addCourse';
|
||||
import clearCourses from '../lib/clearCourses';
|
||||
import createSchedule from '../lib/createSchedule';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
import { Course } from '@shared/types/Course';
|
||||
import type { Course } from '@shared/types/Course';
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
|
||||
/**
|
||||
* Clears the courses for a given schedule.
|
||||
* @param scheduleName - The name of the schedule.
|
||||
* @throws Error if the schedule does not exist.
|
||||
*/
|
||||
export default async function clearCourses(scheduleName: string): Promise<void> {
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
const schedule = schedules.find(schedule => schedule.name === scheduleName);
|
||||
|
||||
@@ -14,7 +14,7 @@ export default async function createSchedule(scheduleName: string): Promise<stri
|
||||
schedules.push({
|
||||
name: scheduleName,
|
||||
courses: [],
|
||||
hours: 0
|
||||
hours: 0,
|
||||
});
|
||||
|
||||
await UserScheduleStore.set('schedules', schedules);
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
|
||||
/**
|
||||
* Deletes a schedule with the specified name.
|
||||
*
|
||||
* @param scheduleName - The name of the schedule to delete.
|
||||
* @returns A promise that resolves to a string if there is an error, or undefined if the schedule is deleted successfully.
|
||||
*/
|
||||
export default async function deleteSchedule(scheduleName: string): Promise<string | undefined> {
|
||||
const [schedules, activeIndex] = await Promise.all([
|
||||
UserScheduleStore.get('schedules'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
import { Course } from '@shared/types/Course';
|
||||
import type { Course } from '@shared/types/Course';
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
|
||||
/**
|
||||
* Renames a schedule with the specified name to a new name.
|
||||
* @param scheduleName - The name of the schedule to be renamed.
|
||||
* @param newName - The new name for the schedule.
|
||||
* @returns A promise that resolves to a string if there is an error, or undefined if the schedule is renamed successfully.
|
||||
*/
|
||||
export default async function renameSchedule(scheduleName: string, newName: string): Promise<string | undefined> {
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
const scheduleIndex = schedules.findIndex(schedule => schedule.name === scheduleName);
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
|
||||
/**
|
||||
* Switches the active schedule to the specified schedule name.
|
||||
* Throws an error if the schedule does not exist.
|
||||
* @param scheduleName - The name of the schedule to switch to.
|
||||
* @returns A Promise that resolves when the active schedule is successfully switched.
|
||||
*/
|
||||
export default async function switchSchedule(scheduleName: string): Promise<void> {
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user