fix: make ESLint work and fix lint errors that were undetected before (#18639)
* fix eslint config * fix * add it to dev dep * fix * sync eslint version * force ts-node to compile our ESLint plugin's TS files into CommonJS (which ESLint requires) * fix some lint errors * fix lint errors * remove duplicate classname * make @typescript-eslint/ban-types a warn for packages/trpc files * fix lint errors in trpc * fix lint errors in trpc - 2 * fix * fix * fix lint warnings
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useAutoAnimate } from "@formkit/auto-animate/react";
|
||||
import { Fragment, ReactElement, useState } from "react";
|
||||
import { z } from "zod";
|
||||
import type { ReactElement } from "react";
|
||||
import { Fragment, useState } from "react";
|
||||
import type { z } from "zod";
|
||||
|
||||
import { WipeMyCalActionButton } from "@calcom/app-store/wipemycalother/components";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
@@ -23,7 +24,7 @@ import useMeQuery from "@lib/hooks/useMeQuery";
|
||||
import BookingListItem from "@components/booking/BookingListItem";
|
||||
import SkeletonLoader from "@components/booking/SkeletonLoader";
|
||||
|
||||
import { validStatuses } from "~/bookings/lib/validStatuses";
|
||||
import type { validStatuses } from "~/bookings/lib/validStatuses";
|
||||
|
||||
type BookingListingStatus = z.infer<NonNullable<typeof filterQuerySchema>>["status"];
|
||||
type BookingOutput = RouterOutputs["viewer"]["bookings"]["get"]["bookings"][0];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { DehydratedState } from "@tanstack/react-query";
|
||||
import type { EmbedProps } from "app/WithEmbedSSR";
|
||||
import type { GetServerSideProps } from "next";
|
||||
import { encode } from "querystring";
|
||||
import type { z } from "zod";
|
||||
@@ -18,7 +19,6 @@ import type { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
import type { UserProfile } from "@calcom/types/UserProfile";
|
||||
|
||||
import { getTemporaryOrgRedirect } from "@lib/getTemporaryOrgRedirect";
|
||||
import type { EmbedProps } from "app/WithEmbedSSR";
|
||||
|
||||
import { ssrInit } from "@server/lib/ssr";
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"@types/react-dom": "^18",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"eslint": "^8",
|
||||
"eslint": "^8.34.0",
|
||||
"eslint-config-next": "14.0.4",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.3.0",
|
||||
|
||||
@@ -87,8 +87,7 @@ export const AlbyPaymentComponent = (props: IAlbyPaymentComponentProps) => {
|
||||
<p className="text-sm">Click or scan the invoice below to pay</p>
|
||||
<Link
|
||||
href={`lightning:${paymentRequest}`}
|
||||
className="inline-flex items-center justify-center rounded-2xl rounded-md border border-transparent p-2 bg-white
|
||||
font-medium text-black shadow-sm hover:brightness-95 focus:outline-none focus:ring-offset-2 p-2">
|
||||
className="inline-flex items-center justify-center rounded-2xl rounded-md border border-transparent bg-white p-2 font-medium text-black shadow-sm hover:brightness-95 focus:outline-none focus:ring-offset-2">
|
||||
<QRCode size={192} value={paymentRequest} />
|
||||
</Link>
|
||||
|
||||
|
||||
@@ -87,6 +87,13 @@ module.exports = {
|
||||
"@calcom/eslint/deprecated-imports-next-router": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["packages/trpc/**/*.{tsx,ts}"],
|
||||
rules: {
|
||||
"@typescript-eslint/ban-types": "warn",
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
// This registers Typescript compiler instance onto node.js.
|
||||
// Now it is possible to just require typescript files without any compilation steps in the environment run by node
|
||||
require("ts-node").register();
|
||||
require("ts-node").register({
|
||||
compilerOptions: {
|
||||
module: "commonjs",
|
||||
},
|
||||
});
|
||||
|
||||
// re-export our rules so that eslint run by node can understand them
|
||||
module.exports = {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import prismaMock from "../../../tests/libs/__mocks__/prismaMock";
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import prismaMock from "../../../tests/libs/__mocks__/prismaMock";
|
||||
|
||||
import { getPaymentAppData } from "../getPaymentAppData";
|
||||
import { handlePaymentRefund } from "./handlePaymentRefund";
|
||||
import { processPaymentRefund } from "./processPaymentRefund";
|
||||
import { RefundPolicy } from "./types";
|
||||
|
||||
vi.mock('@calcom/lib/getPaymentAppData', () => ({
|
||||
vi.mock("@calcom/lib/getPaymentAppData", () => ({
|
||||
getPaymentAppData: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -23,7 +24,7 @@ describe("processPaymentRefund", () => {
|
||||
{
|
||||
id: 1,
|
||||
uid: "unique-id-1",
|
||||
appId: "123",
|
||||
appId: "123",
|
||||
bookingId: 456,
|
||||
amount: 1000,
|
||||
fee: 50,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"eslint": "^8",
|
||||
"eslint": "^8.34.0",
|
||||
"eslint-config-next": "14.0.4",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.3.0",
|
||||
|
||||
@@ -18,10 +18,10 @@ export default function Payment(props: { calUsername: string; calEmail: string }
|
||||
<Navbar username={props.calUsername} />
|
||||
<PaymentForm
|
||||
paymentUid={uid ?? ""}
|
||||
onPaymentSuccess={(data) => {
|
||||
onPaymentSuccess={() => {
|
||||
router.push("/bookings");
|
||||
}}
|
||||
onPaymentCancellation={(data) => {
|
||||
onPaymentCancellation={() => {
|
||||
router.back();
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const ZFindInputSchema = z.object({
|
||||
export const ZFindInputSchema = z.object({
|
||||
bookingUid: z.string().optional(),
|
||||
});
|
||||
|
||||
export type TFindInputSchema = z.infer<typeof ZFindInputSchema>;
|
||||
|
||||
export { ZFindInputSchema };
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const ZInstantBookingInputSchema = z.object({
|
||||
export const ZInstantBookingInputSchema = z.object({
|
||||
bookingId: z.number(),
|
||||
});
|
||||
|
||||
export type TInstantBookingInputSchema = z.infer<typeof ZInstantBookingInputSchema>;
|
||||
|
||||
export { ZInstantBookingInputSchema };
|
||||
|
||||
@@ -75,7 +75,7 @@ const BaseEventTypeUpdateInput = _EventTypeModel
|
||||
.partial()
|
||||
.extend(_EventTypeModel.pick({ id: true }).shape);
|
||||
|
||||
const ZUpdateInputSchema = BaseEventTypeUpdateInput.extend({
|
||||
export const ZUpdateInputSchema = BaseEventTypeUpdateInput.extend({
|
||||
aiPhoneCallConfig: aiPhoneCallConfig.refine(
|
||||
(data) => {
|
||||
if (!data) return true;
|
||||
@@ -92,6 +92,4 @@ const ZUpdateInputSchema = BaseEventTypeUpdateInput.extend({
|
||||
),
|
||||
}).strict();
|
||||
// only run infer over the simple type, excluding refines/transforms.
|
||||
type TUpdateInputSchema = z.infer<typeof BaseEventTypeUpdateInput>;
|
||||
|
||||
export { ZUpdateInputSchema, type TUpdateInputSchema };
|
||||
export type TUpdateInputSchema = z.infer<typeof BaseEventTypeUpdateInput>;
|
||||
|
||||
@@ -15,6 +15,7 @@ import { validateBookerLayouts } from "@calcom/lib/validateBookerLayouts";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { WorkflowTriggerEvents } from "@calcom/prisma/client";
|
||||
import { SchedulingType, EventTypeAutoTranslatedField } from "@calcom/prisma/enums";
|
||||
import { eventTypeAppMetadataOptionalSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
@@ -27,7 +28,6 @@ import {
|
||||
handleCustomInputs,
|
||||
handlePeriodType,
|
||||
} from "./util";
|
||||
import { eventTypeAppMetadataOptionalSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
type SessionUser = NonNullable<TrpcSessionUser>;
|
||||
type User = {
|
||||
|
||||
+7
-1
@@ -454,6 +454,12 @@
|
||||
"HUDDLE01_API_TOKEN",
|
||||
"REPLEXICA_API_KEY",
|
||||
"DIRECTORY_IDS_TO_LOG",
|
||||
"NEXT_PUBLIC_SINGLE_ORG_SLUG"
|
||||
"NEXT_PUBLIC_SINGLE_ORG_SLUG",
|
||||
"GOOGLE_REFRESH_TOKEN",
|
||||
"GOOGLE_CLIENT_ID",
|
||||
"GOOGLE_CLIENT_SECRET",
|
||||
"ZOOM_REFRESH_TOKEN",
|
||||
"CALCOM_ADMIN_API_KEY",
|
||||
"NEXT_PUBLIC_SINGLE_ORG_MODE_ENABLED"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user