Skip to content

Commit 944a3c0

Browse files
authored
Eslint fixes (#1898)
* Eslint fixes * Docs build fixes
1 parent 5185704 commit 944a3c0

33 files changed

+135
-323
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("./packages/config/eslint-preset");

apps/docs/.eslintrc.js

-1
This file was deleted.

apps/docs/next-env.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

apps/docs/next.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
21
const withNextra = require("nextra")({
32
theme: "nextra-theme-docs",
43
themeConfig: "./theme.config.js",

apps/docs/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
78
"dev": "PORT=4000 next",
9+
"lint": "next lint",
810
"start": "PORT=4000 next start",
911
"build": "next build"
1012
},
@@ -16,5 +18,9 @@
1618
"nextra-theme-docs": "^1.2.2",
1719
"react": "^17.0.2",
1820
"react-dom": "^17.0.2"
21+
},
22+
"devDependencies": {
23+
"@calcom/config": "*",
24+
"eslint": "^8.9.0"
1925
}
2026
}

apps/docs/pages/_app.js apps/docs/pages/_app.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "nextra-theme-docs/style.css";
2+
23
import "./style.css";
34

45
export default function Nextra({ Component, pageProps }) {

apps/docs/pages/self-hosting/install.mdx

+33-32
Original file line numberDiff line numberDiff line change
@@ -52,50 +52,51 @@ yarn dx
5252

5353
1. Configure database in the `packages/prisma/.env` file. Replace `<user>`, `<pass>`, `<db-host>`, `<db-port>` with their applicable values
5454

55-
```text
56-
DATABASE_URL='postgresql://<user>:<pass>@<db-host>:<db-port>'
57-
```
55+
```text
56+
DATABASE_URL='postgresql://<user>:<pass>@<db-host>:<db-port>'
57+
```
58+
59+
<details>
5860

59-
<details>
61+
<summary>
62+
If you don't know how to configure the DATABASE_URL, then follow the steps here to create a quick DB
63+
using Heroku
64+
</summary>
6065

61-
<summary>
62-
If you don't know how to configure the DATABASE_URL, then follow the steps here to create a quick DB
63-
using Heroku
64-
</summary>
66+
1. Create a free account with [Heroku](https://www.heroku.com/).
6567

66-
1. Create a free account with [Heroku](https://www.heroku.com/).
68+
2. Create a new app.
6769

68-
2. Create a new app.
70+
<img
71+
width="306"
72+
alt="Create an App"
73+
src="https://user-images.githubusercontent.com/16905768/115322780-b3d58c00-a17e-11eb-8a52-b758fb0ea942.png"
74+
/>
6975

70-
<img
71-
width="306"
72-
alt="Create an App"
73-
src="https://user-images.githubusercontent.com/16905768/115322780-b3d58c00-a17e-11eb-8a52-b758fb0ea942.png"
74-
/>
76+
3. In your new app, go to `Overview` and next to `Installed add-ons`, click `Configure Add-ons`. We need this to set up our database.
77+
![image](https://user-images.githubusercontent.com/16905768/115323232-a53ba480-a17f-11eb-98db-58e2f8c52426.png)
7578

76-
3. In your new app, go to `Overview` and next to `Installed add-ons`, click `Configure Add-ons`. We need this to set up our database.
77-
![image](https://user-images.githubusercontent.com/16905768/115323232-a53ba480-a17f-11eb-98db-58e2f8c52426.png)
79+
4. Once you clicked on `Configure Add-ons`, click on `Find more add-ons` and search for `postgres`. One of the options will be `Heroku Postgres` - click on that option.
80+
![image](https://user-images.githubusercontent.com/16905768/115323126-5beb5500-a17f-11eb-8030-7380310807a9.png)
7881

79-
4. Once you clicked on `Configure Add-ons`, click on `Find more add-ons` and search for `postgres`. One of the options will be `Heroku Postgres` - click on that option.
80-
![image](https://user-images.githubusercontent.com/16905768/115323126-5beb5500-a17f-11eb-8030-7380310807a9.png)
82+
5. Once the pop-up appears, click `Submit Order Form` - plan name should be `Hobby Dev - Free`.
8183

82-
5. Once the pop-up appears, click `Submit Order Form` - plan name should be `Hobby Dev - Free`.
84+
<img
85+
width="512"
86+
alt="Submit Order Form"
87+
src="https://user-images.githubusercontent.com/16905768/115323265-b4baed80-a17f-11eb-99f0-d67f019aa6df.png"
88+
/>
8389

84-
<img
85-
width="512"
86-
alt="Submit Order Form"
87-
src="https://user-images.githubusercontent.com/16905768/115323265-b4baed80-a17f-11eb-99f0-d67f019aa6df.png"
88-
/>
90+
6. Once you completed the above steps, click on your newly created `Heroku Postgres` and go to its `Settings`.
91+
![image](https://user-images.githubusercontent.com/16905768/115323367-e92ea980-a17f-11eb-9ff4-dec95f2ec349.png)
8992

90-
6. Once you completed the above steps, click on your newly created `Heroku Postgres` and go to its `Settings`.
91-
![image](https://user-images.githubusercontent.com/16905768/115323367-e92ea980-a17f-11eb-9ff4-dec95f2ec349.png)
93+
7. In `Settings`, copy your URI to your Cal.com .env file and replace the `postgresql://<user>:<pass>@<db-host>:<db-port>` with it.
94+
![image](https://user-images.githubusercontent.com/16905768/115323556-4591c900-a180-11eb-9808-2f55d2aa3995.png)
95+
![image](https://user-images.githubusercontent.com/16905768/115323697-7a9e1b80-a180-11eb-9f08-a742b1037f90.png)
9296

93-
7. In `Settings`, copy your URI to your Cal.com .env file and replace the `postgresql://<user>:<pass>@<db-host>:<db-port>` with it.
94-
![image](https://user-images.githubusercontent.com/16905768/115323556-4591c900-a180-11eb-9808-2f55d2aa3995.png)
95-
![image](https://user-images.githubusercontent.com/16905768/115323697-7a9e1b80-a180-11eb-9f08-a742b1037f90.png)
97+
8. To view your DB, once you add new data in Prisma, you can use [Heroku Data Explorer](https://heroku-data-explorer.herokuapp.com/).
9698

97-
8. To view your DB, once you add new data in Prisma, you can use [Heroku Data Explorer](https://heroku-data-explorer.herokuapp.com/).
98-
</details>
99+
</details>
99100

100101
1. Set a 32 character random string in your `apps/web/.env` file for the `CALENDSO_ENCRYPTION_KEY` (You can use a command like `openssl rand -base64 24` to generate one).
101102
1. Set up the database using the Prisma schema (found in `packages/prisma/schema.prisma`)

apps/docs/tsconfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "@calcom/tsconfig/nextjs.json",
3+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
4+
"exclude": ["node_modules"]
5+
}

apps/web/.eslintrc.js

-1
This file was deleted.

apps/web/components/booking/DatePicker.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ function isOutOfBounds(
5151
switch (periodType) {
5252
case PeriodType.ROLLING: {
5353
const periodRollingEndDay = periodCountCalendarDays
54-
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
55-
dayjs().utcOffset(date.utcOffset()).add(periodDays!, "days").endOf("day")
56-
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
57-
dayjs().utcOffset(date.utcOffset()).addBusinessTime(periodDays!, "days").endOf("day");
54+
? dayjs().utcOffset(date.utcOffset()).add(periodDays!, "days").endOf("day")
55+
: dayjs().utcOffset(date.utcOffset()).addBusinessTime(periodDays!, "days").endOf("day");
5856
return date.endOf("day").isAfter(periodRollingEndDay);
5957
}
6058

apps/web/components/booking/pages/BookingPage.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ const BookingPage = (props: BookingPageProps) => {
6161
const eventOwner = eventType.users[0];
6262

6363
if (!contracts[(eventType.metadata.smartContractAddress || null) as number])
64-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6564
/* @ts-ignore */
6665
router.replace(`/${eventOwner.username}`);
6766
}
6867
}, [contracts, eventType.metadata.smartContractAddress, router]);
6968

7069
const mutation = useMutation(createBooking, {
71-
onSuccess: async ({ attendees, paymentUid, ...responseData }) => {
70+
onSuccess: async (responseData) => {
71+
const { attendees, paymentUid } = responseData;
7272
if (paymentUid) {
7373
return await router.push(
7474
createPaymentLink({
@@ -239,7 +239,6 @@ const BookingPage = (props: BookingPageProps) => {
239239
let web3Details;
240240
if (eventTypeDetail.metadata.smartContractAddress) {
241241
web3Details = {
242-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
243242
// @ts-ignore
244243
userWallet: window.web3.currentProvider.selectedAddress,
245244
userSignature: contracts[(eventTypeDetail.metadata.smartContractAddress || null) as number],
@@ -259,9 +258,7 @@ const BookingPage = (props: BookingPageProps) => {
259258
location: getLocationValue(booking.locationType ? booking : { locationType: selectedLocation }),
260259
metadata,
261260
customInputs: Object.keys(booking.customInputs || {}).map((inputId) => ({
262-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
263261
label: props.eventType.customInputs.find((input) => input.id === parseInt(inputId))!.label,
264-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
265262
value: booking.customInputs![inputId],
266263
})),
267264
});
@@ -397,7 +394,6 @@ const BookingPage = (props: BookingPageProps) => {
397394
{t("phone_number")}
398395
</label>
399396
<div className="mt-1">
400-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
401397
{/* @ts-ignore */}
402398
<PhoneInput name="phone" placeholder={t("enter_phone_number")} id="phone" required />
403399
</div>

apps/web/contexts/contractsContext.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export function ContractsProvider({ children }: Props) {
3838

3939
return (
4040
<>
41-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
4241
{/* @ts-ignore */}
4342
<ContractsContext.Provider value={value}>{children}</ContractsContext.Provider>
4443
</>

apps/web/ee/components/web3/CryptoSection.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ const CryptoSection = (props: CryptoSectionProps) => {
6565
} else {
6666
const account = (await window.web3.eth.getAccounts())[0];
6767

68-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6968
// @ts-ignore
7069
const signature = await window.web3.eth.personal.sign(AUTH_MESSAGE, account);
71-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
7270
// @ts-ignore
7371
addContract({ address: props.smartContractAddress, signature });
7472

apps/web/lib/QueryCell.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export function QueryCell<TData, TError extends ErrorLike>(
5353
if ("empty" in opts && (query.data == null || (Array.isArray(query.data) && query.data.length === 0))) {
5454
return opts.empty(query);
5555
}
56-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5756
return opts.success(query as any);
5857
}
5958
if (query.status === "error") {

apps/web/lib/jackson.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const opts: JacksonOption = {
1919
let apiController: IAPIController;
2020
let oauthController: IOAuthController;
2121

22-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2322
const g = global as any;
2423

2524
export default async function init() {

apps/web/lib/slots.ts

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const getMinuteOffset = (date: Dayjs, frequency: number) => {
2424
return Math.ceil(minuteOffset / frequency) * frequency;
2525
};
2626

27-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2827
const getSlots = ({ inviteeDate, frequency, minimumBookingNotice, workingHours }: GetSlots) => {
2928
// current date in invitee tz
3029
const startDate = dayjs().add(minimumBookingNotice, "minute");

apps/web/lib/telemetry.ts

-3
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ function createTelemetryClient(): TelemetryClient {
7676
return;
7777
} else if (
7878
// FIXME
79-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
8079
// @ts-ignore
8180
!window["jitsu"]
8281
) {
8382
// FIXME
84-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
8583
// @ts-ignore
8684
window["jitsu"] = jitsuClient({
8785
log_level: "ERROR",
@@ -92,7 +90,6 @@ function createTelemetryClient(): TelemetryClient {
9290
});
9391
}
9492
// FIXME
95-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
9693
// @ts-ignore
9794
const res = callback(window["jitsu"]);
9895
if (res && typeof res["catch"] === "function") {

apps/web/lib/types/inferSSRProps.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
31
type GetSSRResult<TProps> =
42
//
53
{ props: TProps } | { redirect: any } | { notFound: boolean };

apps/web/next-i18next.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
21
const path = require("path");
32

43
module.exports = {

apps/web/next.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
21
const withTM = require("@vercel/edge-functions-ui/transpile")(["@calcom/lib", "@calcom/prisma"]);
32
const { i18n } = require("./next-i18next.config");
43

apps/web/package.json

+4-13
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"type-check": "tsc --pretty --noEmit",
1717
"build": "next build",
1818
"start": "next start",
19-
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
20-
"lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
19+
"lint": "next lint",
20+
"lint:fix": "next lint . --ext .ts,.js,.tsx,.jsx --fix",
2121
"check-changed-files": "ts-node scripts/ts-check-changed-files.ts"
2222
},
2323
"engines": {
@@ -103,10 +103,10 @@
103103
"zod": "^3.8.2"
104104
},
105105
"devDependencies": {
106+
"@calcom/config": "*",
106107
"@microsoft/microsoft-graph-types-beta": "0.15.0-preview",
107108
"@playwright/test": "^1.18.1",
108109
"@tailwindcss/forms": "^0.4.0",
109-
"@trivago/prettier-plugin-sort-imports": "2.0.4",
110110
"@types/accept-language-parser": "1.5.2",
111111
"@types/async": "^3.2.10",
112112
"@types/bcryptjs": "^2.4.2",
@@ -123,24 +123,15 @@
123123
"@types/react-window": "^1.8.5",
124124
"@types/stripe": "^8.0.417",
125125
"@types/uuid": "8.3.1",
126-
"@typescript-eslint/eslint-plugin": "^4.33.0",
127-
"@typescript-eslint/parser": "^4.33.0",
128126
"autoprefixer": "^10.4.0",
129127
"babel-jest": "^27.3.1",
130128
"env-cmd": "10.1.0",
131-
"eslint": "^7.32.0",
132-
"eslint-config-prettier": "^8.3.0",
133-
"eslint-plugin-playwright": "^0.7.1",
134-
"eslint-plugin-prettier": "^3.4.0",
135-
"eslint-plugin-react": "^7.27.1",
136-
"eslint-plugin-react-hooks": "^4.3.0",
137129
"jest": "^26.0.0",
138130
"mockdate": "^3.0.5",
139131
"module-alias": "^2.2.2",
140132
"npm-run-all": "^4.1.5",
141133
"postcss": "^8.4.4",
142-
"prettier": "^2.5.1",
143-
"prettier-plugin-tailwindcss": "^0.1.6",
134+
"eslint": "^8.9.0",
144135
"tailwindcss": "^3.0.0",
145136
"ts-jest": "^26.0.0",
146137
"ts-node": "^10.2.1",

apps/web/pages/_error.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const CustomError: NextPage<CustomErrorProps> = (props) => {
3333
// getInitialProps is not called in case of
3434
// https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
3535
// err via _app.tsx so it can be captured
36-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
36+
// eslint-disable-next-line no-unused-vars
3737
const e = getErrorFromUnknown(err);
3838
// can be captured here
3939
// e.g. Sentry.captureException(e);

apps/web/pages/api/book/event.ts

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ function isAvailable(busyTimes: BufferedBusyTimes, time: string, length: number)
104104

105105
function isOutOfBounds(
106106
time: dayjs.ConfigType,
107-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
108107
{ periodType, periodDays, periodCountCalendarDays, periodStartDate, periodEndDate, timeZone }: any // FIXME types
109108
): boolean {
110109
const date = dayjs(time);

apps/web/pages/getting-started.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
188188
steps[currentStep].onComplete &&
189189
typeof steps[currentStep].onComplete === "function"
190190
) {
191-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
192191
await steps[currentStep].onComplete!();
193192
}
194193
incrementStep();

apps/web/pages/settings/profile.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
137137
return (router.locales || []).map((locale) => ({
138138
value: locale,
139139
// FIXME
140-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
141140
// @ts-ignore
142141
label: new Intl.DisplayNames(props.localeProp, { type: "language" }).of(locale),
143142
}));

apps/web/pages/video/meeting-ended/[uid].tsx

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Button from "@components/ui/Button";
1616
export default function MeetingUnavailable(props: inferSSRProps<typeof getServerSideProps>) {
1717
const router = useRouter();
1818

19-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2019
const [is24h, setIs24h] = useState(false);
2120

2221
//if no booking redirectis to the 404 page

apps/web/pages/video/meeting-not-started/[uid].tsx

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default function MeetingNotStarted(props: inferSSRProps<typeof getServerS
2323
router.push("/video/no-meeting-found");
2424
}
2525
});
26-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2726
const [is24h, setIs24h] = useState(false);
2827
if (!emptyBooking) {
2928
return (

apps/web/playwright/lib/testUtils.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { test } from "@playwright/test";
22
import { createServer, IncomingMessage, ServerResponse } from "http";
33

44
export function todo(title: string) {
5-
// eslint-disable-next-line @typescript-eslint/no-empty-function
65
test.skip(title, () => {});
76
}
87

apps/web/scripts/ts-check-changed-files.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-explicit-any */
21
import { execSync } from "child_process";
32

43
const diff = execSync(`git diff --name-only origin/main HEAD`).toString();

apps/web/types/next-auth.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unused-vars */
21
import NextAuth, { DefaultSession } from "next-auth";
32

43
declare module "next-auth" {

0 commit comments

Comments
 (0)