chore: fix all @typescript-eslint/no-unused-vars warnings (#10645)

Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
GitStart-Cal.com
2023-08-25 11:48:24 +00:00
committed by GitHub
co-authored by gitstart-calcom Hariom Balhara Keith Williams
parent d55b4b051a
commit 80353d67a0
23 changed files with 42 additions and 87 deletions
-1
View File
@@ -53,7 +53,6 @@ export function UserPage(props: InferGetServerSidePropsType<typeof getServerSide
orgSlug: _orgSlug,
...query
} = useRouterQuery();
const nameOrUsername = user.name || user.username || "";
/*
const telemetry = useTelemetry();
-48
View File
@@ -7,54 +7,6 @@ import { getTranslation } from "@calcom/lib/server/i18n";
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
if (IS_PRODUCTION) return res.write("Only for development purposes"), res.end();
const t = await getTranslation("en", "common");
const language = { translate: t, locale: "en" };
const evt = {
type: "30min",
title: "30min between Pro Example and pro@example.com",
description: null,
additionalNotes: "asdasdas",
startTime: "2022-06-03T09:00:00-06:00",
endTime: "2022-06-03T09:30:00-06:00",
organizer: {
name: "Pro Example",
email: "pro@example.com",
timeZone: "Europe/London",
language,
},
attendees: [
{
email: "pro@example.com",
name: "pro@example.com",
timeZone: "America/Chihuahua",
language,
},
],
location: "Zoom video",
destinationCalendar: null,
hideCalendarNotes: false,
uid: "xxyPr4cg2xx4XoS2KeMEQy",
metadata: {},
recurringEvent: null,
appsStatus: [
{
appName: "Outlook Calendar",
type: "office365_calendar",
success: 1,
failures: 0,
errors: [],
warnings: [],
},
{
appName: "Google Meet",
type: "conferencing",
success: 0,
failures: 1,
errors: [],
warnings: ["In order to use Google Meet you must set your destination calendar to a Google Calendar"],
},
],
};
res.statusCode = 200;
@@ -411,6 +411,7 @@ const EventTypePage = (props: EventTypeSetupProps) => {
throw new Error(t("seats_and_no_show_fee_error"));
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { availability, ...rest } = input;
updateMutation.mutate({
...rest,
@@ -495,6 +496,7 @@ const EventTypePage = (props: EventTypeSetupProps) => {
}
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { availability, ...rest } = input;
updateMutation.mutate({
...rest,
@@ -77,7 +77,7 @@ type FormValues = {
const ProfileView = () => {
const { t } = useLocale();
const utils = trpc.useContext();
const { data: _session, update } = useSession();
const { update } = useSession();
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const updateProfileMutation = trpc.viewer.updateProfile.useMutation({
@@ -303,6 +303,7 @@ describe("handleChildrenEventTypes", () => {
timeZone: _timeZone,
parentId: _parentId,
userId: _userId,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
requiresBookerEmailVerification,
...evType
} = mockFindFirstEventType({
@@ -11,7 +11,7 @@ import type { appDataSchema } from "../zod";
const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({ eventType, app }) {
const { t } = useLocale();
const [getAppData, setAppData, LockedIcon, disabled] = useAppContextWithSchema<typeof appDataSchema>();
const [_getAppData, setAppData, LockedIcon, disabled] = useAppContextWithSchema<typeof appDataSchema>();
const [additionalParameters, setAdditionalParameters] = useState("");
const { enabled, updateEnabled } = useIsAppEnabled(app);
@@ -66,7 +66,6 @@ function Field({
hookForm,
hookFieldNamespace,
deleteField,
fieldIndex,
moveUp,
moveDown,
appUrl,
@@ -3,7 +3,6 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { stringify } from "querystring";
import createOAuthAppCredential from "../../_utils/createOAuthAppCredential";
import { decodeOAuthState } from "../../_utils/decodeOAuthState";
import getInstalledAppPath from "../../_utils/getInstalledAppPath";
import type { StripeData } from "../lib/server";
import stripe from "../lib/server";
@@ -31,8 +30,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
return res.status(401).json({ message: "You must be logged in to do this" });
}
const state = decodeOAuthState(req);
const response = await stripe.oauth.token({
grant_type: "authorization_code",
code: code?.toString(),
@@ -9,7 +9,6 @@ import stripe from "../lib/server";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== "POST" && req.method !== "GET")
return res.status(405).json({ message: "Method not allowed" });
const { referer } = req.headers;
// if (!referer) return res.status(400).json({ message: "Missing referrer" });
-1
View File
@@ -562,7 +562,6 @@ class CalApi {
modal({
calLink,
calOrigin,
config = {},
uid,
}: {
@@ -1,17 +1,17 @@
import { useMemo, useRef, useEffect } from "react";
import { useRef, useEffect } from "react";
import dayjs from "@calcom/dayjs";
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { AvailableTimes, AvailableTimesSkeleton } from "@calcom/features/bookings";
import { useNonEmptyScheduleDays } from "@calcom/features/schedules";
import { useSlotsForAvailableDates } from "@calcom/features/schedules/lib/use-schedule/useSlotsForDate";
import { classNames } from "@calcom/lib";
import { trpc } from "@calcom/trpc";
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";
import { BookerLayouts } from "@calcom/prisma/zod-utils";
import { trpc } from "@calcom/trpc";
import { useBookerStore } from "../store";
import { useEvent, useScheduleForEvent } from "../utils/event";
import { useNonEmptyScheduleDays } from "@calcom/features/schedules";
import { BookerLayouts } from "@calcom/prisma/zod-utils";
type AvailableTimeSlotsProps = {
extraDays?: number;
@@ -28,7 +28,13 @@ type AvailableTimeSlotsProps = {
* will also fetch the next `extraDays` days and show multiple days
* in columns next to each other.
*/
export const AvailableTimeSlots = ({ extraDays, limitHeight, seatsPerTimeSlot, prefetchNextMonth, monthCount}: AvailableTimeSlotsProps) => {
export const AvailableTimeSlots = ({
extraDays,
limitHeight,
seatsPerTimeSlot,
prefetchNextMonth,
monthCount,
}: AvailableTimeSlotsProps) => {
const reserveSlotMutation = trpc.viewer.public.slots.reserveSlot.useMutation();
const isMobile = useMediaQuery("(max-width: 768px)");
const selectedDate = useBookerStore((state) => state.selectedDate);
@@ -68,15 +74,19 @@ export const AvailableTimeSlots = ({ extraDays, limitHeight, seatsPerTimeSlot, p
prefetchNextMonth,
monthCount,
});
const nonEmptyScheduleDays = useNonEmptyScheduleDays(schedule?.data?.slots)
const nonEmptyScheduleDaysFromSelectedDate = nonEmptyScheduleDays.filter((slot)=>dayjs(selectedDate).diff(slot,'day')<=0);
const nonEmptyScheduleDays = useNonEmptyScheduleDays(schedule?.data?.slots);
const nonEmptyScheduleDaysFromSelectedDate = nonEmptyScheduleDays.filter(
(slot) => dayjs(selectedDate).diff(slot, "day") <= 0
);
// Creates an array of dates to fetch slots for.
// If `extraDays` is passed in, we will extend the array with the next `extraDays` days.
const dates = !extraDays
? [date]: nonEmptyScheduleDaysFromSelectedDate.length > 0
? nonEmptyScheduleDaysFromSelectedDate.slice(0, extraDays):[];
? [date]
: nonEmptyScheduleDaysFromSelectedDate.length > 0
? nonEmptyScheduleDaysFromSelectedDate.slice(0, extraDays)
: [];
const slotsPerDay = useSlotsForAvailableDates(dates, schedule?.data?.slots);
useEffect(() => {
@@ -106,10 +116,13 @@ export const AvailableTimeSlots = ({ extraDays, limitHeight, seatsPerTimeSlot, p
date={dayjs(slots.date)}
slots={slots.slots}
seatsPerTimeSlot={seatsPerTimeSlot}
availableMonth={dayjs(selectedDate).format("MM")!==dayjs(slots.date).format("MM")?dayjs(slots.date).format("MMM"):undefined}
availableMonth={
dayjs(selectedDate).format("MM") !== dayjs(slots.date).format("MM")
? dayjs(slots.date).format("MMM")
: undefined
}
/>
))}
</div>
);
};
@@ -26,7 +26,7 @@ type AvailableTimesProps = {
seatsPerTimeSlot?: number | null;
showTimeFormatToggle?: boolean;
className?: string;
availableMonth?: String | undefined;
availableMonth?: string | undefined;
selectedSlots?: string[];
};
@@ -66,7 +66,8 @@ export const AvailableTimes = ({
"inline-flex items-center justify-center rounded-3xl px-1 pt-0.5 font-medium",
isMonthView ? "text-default text-sm" : "text-xs"
)}>
{date.format("DD")}{availableMonth && `, ${availableMonth}`}
{date.format("DD")}
{availableMonth && `, ${availableMonth}`}
</span>
</span>
@@ -136,4 +137,3 @@ export const AvailableTimesSkeleton = () => (
))}
</div>
);
@@ -1,7 +1,6 @@
import { useMemo } from "react";
import type { Slots } from "./types";
import dayjs from "@calcom/dayjs";
/**
* Get's slots for a specific date from the schedul cache.
@@ -18,8 +17,7 @@ export const useSlotsForDate = (date: string | null, slots?: Slots) => {
return slotsForDate;
};
export const useSlotsForAvailableDates = ( dates: (string | null)[], slots?: Slots) => {
export const useSlotsForAvailableDates = (dates: (string | null)[], slots?: Slots) => {
const slotsForDates = useMemo(() => {
if (slots === undefined) return [];
return dates
@@ -11,7 +11,7 @@ type GetOptions = {
input: TListMembersSchema;
};
export const listPaginatedHandler = async ({ ctx, input }: GetOptions) => {
export const listPaginatedHandler = async ({ input }: GetOptions) => {
const { cursor, limit, searchTerm } = input;
const getTotalUsers = await prisma.user.count();
@@ -14,7 +14,7 @@ type GetOptions = {
input: TAdminPasswordResetSchema;
};
export const sendPasswordResetHandler = async ({ ctx, input }: GetOptions) => {
export const sendPasswordResetHandler = async ({ input }: GetOptions) => {
const { userId } = input;
const user = await prisma.user.findUnique({
@@ -10,7 +10,7 @@ type checkForGlobalKeys = {
input: CheckGlobalKeysSchemaType;
};
export const checkForGlobalKeysHandler = async ({ ctx, input }: checkForGlobalKeys) => {
export const checkForGlobalKeysHandler = async ({ input }: checkForGlobalKeys) => {
const appIsGloballyInstalled = await prisma.app.findUnique({
where: {
slug: input.slug,
@@ -1,5 +1,4 @@
import { sendEmailVerificationByCode } from "@calcom/features/auth/lib/verifyEmail";
import logger from "@calcom/lib/logger";
import type { TSendVerifyEmailCodeSchema } from "./sendVerifyEmailCode.schema";
@@ -7,8 +6,6 @@ type SendVerifyEmailCode = {
input: TSendVerifyEmailCodeSchema;
};
const log = logger.getChildLogger({ prefix: [`[[Auth] `] });
export const sendVerifyEmailCodeHandler = async ({ input }: SendVerifyEmailCode) => {
const email = await sendEmailVerificationByCode({
email: input.email,
@@ -32,7 +32,7 @@ export const checkForGWorkspace = async ({ ctx }: CheckForGCalOptions) => {
return { id: gWorkspacePresent?.id };
};
export const getUsersFromGWorkspace = async ({ ctx }: CheckForGCalOptions) => {
export const getUsersFromGWorkspace = async ({}: CheckForGCalOptions) => {
const { client_id, client_secret } = await getAppKeysFromSlug("google-calendar");
if (!client_id || typeof client_id !== "string") throw new Error("Google client_id missing.");
if (!client_secret || typeof client_secret !== "string") throw new Error("Google client_secret missing.");
@@ -9,7 +9,7 @@ type AdminGetAllOptions = {
};
};
export const adminGetUnverifiedHandler = async ({ ctx }: AdminGetAllOptions) => {
export const adminGetUnverifiedHandler = async ({}: AdminGetAllOptions) => {
const allOrgs = await prisma.team.findMany({
where: {
AND: [
@@ -21,7 +21,7 @@ type ListOptions = {
input: TListOtherTeamMembersSchema;
};
export const listOtherTeamMembers = async ({ ctx, input }: ListOptions) => {
export const listOtherTeamMembers = async ({ input }: ListOptions) => {
const whereConditional: Prisma.MembershipWhereInput = {
teamId: input.teamId,
};
+1 -1
View File
@@ -1,6 +1,6 @@
import React, { forwardRef } from "react";
export const Discord = forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(function Discord(props, ref) {
export const Discord = forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(function Discord(props) {
return (
<svg
className={props.className}
@@ -1,10 +1,8 @@
import { render } from "@testing-library/react";
import { vi } from "vitest";
import { ScrollableArea } from "./ScrollableArea";
describe("Tests for ScrollableArea Component", () => {
const toJSONMock = vi.fn();
test("Should render children inside the scrollable area", () => {
const { getByText } = render(
<ScrollableArea>
+1
View File
@@ -35,6 +35,7 @@ SheetPortal.displayName = SheetPrimitive.Portal.displayName;
const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
// eslint-disable-next-line @typescript-eslint/no-unused-vars
>(({ className, children, ...props }, ref) => (
<SheetPrimitive.Overlay
className={classNames(