feat: Introduce biome (#25664)

* Configure biome

* Fix companion build

* fix: remove generated files from formatter ignore list to enable proper formatting

Co-Authored-By: Volnei Munhoz <[email protected]>

* fix: add explicit stripe dependency to @calcom/features to fix type resolution

Co-Authored-By: Volnei Munhoz <[email protected]>

* fix: rename const require to nodeRequire in generate-swagger.ts to avoid TypeScript reserved identifier conflict

Co-Authored-By: Volnei Munhoz <[email protected]>

* fix: add guard for document in makeBodyVisible to prevent test environment teardown errors

Co-Authored-By: Volnei Munhoz <[email protected]>

* fix: replace ESLint with Biome CLI in embed-code-generator.e2e.ts

Co-Authored-By: Volnei Munhoz <[email protected]>

* fix: address cubic review comments

- Fix invalid --reporter-path Biome CLI option by using shell redirection
- Fix packages/lib lint report filename (app-store.json -> lib.json)
- Add typescript-eslint and eslint back to companion for lint:react-compiler
- Add missing restricted import rules to biome.json:
  - packages/lib: add ../trpc/** and @trpc/server restrictions
  - packages/trpc: add ../apps/web/** restriction

Co-Authored-By: Volnei Munhoz <[email protected]>

* chore: regenerate companion bun.lock after adding eslint dependencies

Co-Authored-By: Volnei Munhoz <[email protected]>

* Remove remaining eslint things

* add tailwind directives

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-12-29 19:41:41 -03:00
1 parent 96dc3b5cc6
commit 7c373ddad6
80 files changed
+1024 -3946

No files matched your search

+1 -2
View File
@@ -26,10 +26,9 @@
"react": "18.2.0"
},
"devDependencies": {
"@biomejs/biome": "^2.3.8",
"@types/react": "18.0.26",
"chokidar": "3.6.0",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "4.6.0",
"ts-node": "10.9.2",
"typescript": "5.9.2"
}
+106 -35
View File
@@ -2,12 +2,8 @@ import chokidar from "chokidar";
import fs from "fs";
// eslint-disable-next-line no-restricted-imports
import { debounce } from "lodash";
import { spawnSync } from "child_process";
import path from "path";
import prettier from "prettier";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
import prettierConfig from "@calcom/config/prettier-preset";
import type { AppMeta } from "@calcom/types/App";
import { AppMetaSchema } from "@calcom/types/AppMetaSchema";
@@ -16,16 +12,30 @@ import { getAppName } from "./utils/getAppName";
const isInWatchMode = process.argv[2] === "--watch";
const formatOutput = (source: string) =>
prettier.format(source, {
parser: "babel",
...prettierConfig,
});
const repoRoot = path.resolve(__dirname, "../../..");
const getVariableName = (appName: string) => appName.replace(/[-.\/]/g, "_");
const formatFileWithBiome = (filePath: string) => {
const { status } = spawnSync(
"yarn",
["biome", "format", "--write", "--no-errors-on-unmatched", filePath],
{
stdio: "inherit",
cwd: repoRoot,
}
);
if (status !== 0) {
throw new Error(`Biome formatting failed for ${filePath}`);
}
};
const formatOutput = (source: string) => source;
const getVariableName = (appName: string) => appName.replace(/[-./]/g, "_");
// INFO: Handle stripe separately as it's an old app with different dirName than slug/appId
const getAppId = (app: { name: string }) => (app.name === "stripepayment" ? "stripe" : app.name);
const getAppId = (app: { name: string }) =>
app.name === "stripepayment" ? "stripe" : app.name;
type App = Partial<AppMeta> & {
name: string;
@@ -41,9 +51,9 @@ function generateFiles() {
const crmOutput = [];
const appDirs: { name: string; path: string }[] = [];
fs.readdirSync(`${APP_STORE_PATH}`).forEach(function (dir) {
fs.readdirSync(`${APP_STORE_PATH}`).forEach((dir) => {
if (dir === "ee" || dir === "templates") {
fs.readdirSync(path.join(APP_STORE_PATH, dir)).forEach(function (subDir) {
fs.readdirSync(path.join(APP_STORE_PATH, dir)).forEach((subDir) => {
if (fs.statSync(path.join(APP_STORE_PATH, dir, subDir)).isDirectory()) {
if (getAppName(subDir)) {
appDirs.push({
@@ -66,11 +76,22 @@ function generateFiles() {
}
});
function forEachAppDir(callback: (arg: App) => void, filter: (arg: App) => boolean = () => true) {
function forEachAppDir(
callback: (arg: App) => void,
filter: (arg: App) => boolean = () => true
) {
for (let i = 0; i < appDirs.length; i++) {
const configPath = path.join(APP_STORE_PATH, appDirs[i].path, "config.json");
const metadataPath = path.join(APP_STORE_PATH, appDirs[i].path, "_metadata.ts");
let app;
const configPath = path.join(
APP_STORE_PATH,
appDirs[i].path,
"config.json"
);
const metadataPath = path.join(
APP_STORE_PATH,
appDirs[i].path,
"_metadata.ts"
);
let app: AppMetaSchema;
if (fs.existsSync(configPath)) {
try {
@@ -78,8 +99,16 @@ function generateFiles() {
const parsedConfig = JSON.parse(rawConfig);
app = AppMetaSchema.parse(parsedConfig);
} catch (error) {
const prefix = `Config error in ${path.join(APP_STORE_PATH, appDirs[i].path, "config.json")}`;
throw new Error(`${prefix}: ${error instanceof Error ? error.message : String(error)}`);
const prefix = `Config error in ${path.join(
APP_STORE_PATH,
appDirs[i].path,
"config.json"
)}`;
throw new Error(
`${prefix}: ${
error instanceof Error ? error.message : String(error)
}`
);
}
} else if (fs.existsSync(metadataPath)) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -148,12 +177,18 @@ function generateFiles() {
const getLocalImportName = (
app: { name: string },
chosenConfig: ReturnType<typeof getChosenImportConfig>
) => `${getVariableName(app.name)}_${getVariableName(chosenConfig.fileToBeImported)}`;
) =>
`${getVariableName(app.name)}_${getVariableName(
chosenConfig.fileToBeImported
)}`;
const fileToBeImportedExists = (
app: { path: string },
chosenConfig: ReturnType<typeof getChosenImportConfig>
) => fs.existsSync(path.join(APP_STORE_PATH, app.path, chosenConfig.fileToBeImported));
) =>
fs.existsSync(
path.join(APP_STORE_PATH, app.path, chosenConfig.fileToBeImported)
);
addImportStatements();
createExportObject();
@@ -163,13 +198,19 @@ function generateFiles() {
function addImportStatements() {
forEachAppDir((app) => {
const chosenConfig = getChosenImportConfig(importConfig, app);
if (fileToBeImportedExists(app, chosenConfig) && chosenConfig.importName) {
if (
fileToBeImportedExists(app, chosenConfig) &&
chosenConfig.importName
) {
const importName = chosenConfig.importName;
if (!lazyImport) {
if (importName !== "default") {
// Import with local alias that will be used by createExportObject
output.push(
`import { ${importName} as ${getLocalImportName(app, chosenConfig)} } from "${getModulePath(
`import { ${importName} as ${getLocalImportName(
app,
chosenConfig
)} } from "${getModulePath(
app.path,
chosenConfig.fileToBeImported
)}"`
@@ -177,7 +218,10 @@ function generateFiles() {
} else {
// Default Import
output.push(
`import ${getLocalImportName(app, chosenConfig)} from "${getModulePath(
`import ${getLocalImportName(
app,
chosenConfig
)} from "${getModulePath(
app.path,
chosenConfig.fileToBeImported
)}"`
@@ -208,7 +252,12 @@ function generateFiles() {
)}")),`
);
} else {
output.push(`"${key}": import("${getModulePath(app.path, chosenConfig.fileToBeImported)}"),`);
output.push(
`"${key}": import("${getModulePath(
app.path,
chosenConfig.fileToBeImported
)}"),`
);
}
}
}
@@ -217,13 +266,24 @@ function generateFiles() {
output.push(`};`);
}
function getChosenImportConfig(importConfig: ImportConfig, app: { path: string }) {
let chosenConfig;
function getChosenImportConfig(
importConfig: ImportConfig,
app: { path: string }
) {
let chosenConfig: ImportConfig;
if (!(importConfig instanceof Array)) {
if (!Array.isArray(importConfig)) {
chosenConfig = importConfig;
} else {
if (fs.existsSync(path.join(APP_STORE_PATH, app.path, importConfig[0].fileToBeImported))) {
if (
fs.existsSync(
path.join(
APP_STORE_PATH,
app.path,
importConfig[0].fileToBeImported
)
)
) {
chosenConfig = importConfig[0];
} else {
chosenConfig = importConfig[1];
@@ -409,7 +469,10 @@ function generateFiles() {
);
if (analyticsExportLineIndex !== -1) {
const exportLine = analyticsServices[analyticsExportLineIndex];
const objectContent = analyticsServices.slice(analyticsExportLineIndex + 1, -1);
const objectContent = analyticsServices.slice(
analyticsExportLineIndex + 1,
-1
);
analyticsOutput.push(
exportLine.replace(
@@ -434,7 +497,9 @@ function generateFiles() {
lazyImport: true,
},
(app: App) => {
const hasPaymentService = fs.existsSync(path.join(APP_STORE_PATH, app.path, "lib/PaymentService.ts"));
const hasPaymentService = fs.existsSync(
path.join(APP_STORE_PATH, app.path, "lib/PaymentService.ts")
);
return hasPaymentService;
}
);
@@ -452,7 +517,9 @@ function generateFiles() {
lazyImport: true,
},
(app: App) => {
return fs.existsSync(path.join(APP_STORE_PATH, app.path, "lib/VideoApiAdapter.ts"));
return fs.existsSync(
path.join(APP_STORE_PATH, app.path, "lib/VideoApiAdapter.ts")
);
}
);
@@ -494,9 +561,13 @@ function generateFiles() {
["video.adapters.generated.ts", videoOutput],
];
filesToGenerate.forEach(([fileName, output]) => {
fs.writeFileSync(`${APP_STORE_PATH}/${fileName}`, formatOutput(`${banner}${output.join("\n")}`));
const filePath = `${APP_STORE_PATH}/${fileName}`;
fs.writeFileSync(filePath, formatOutput(`${banner}${output.join("\n")}`));
formatFileWithBiome(filePath);
});
console.log(`Generated ${filesToGenerate.map(([fileName]) => fileName).join(", ")}`);
console.log(
`Generated ${filesToGenerate.map(([fileName]) => fileName).join(", ")}`
);
}
const debouncedGenerateFiles = debounce(generateFiles);
-1
View File
@@ -1 +0,0 @@
*.generated.*
+125 -44
View File
@@ -5,67 +5,148 @@
import dynamic from "next/dynamic";
export const InstallAppButtonMap = {
exchange2013calendar: dynamic(() => import("./exchange2013calendar/components/InstallAppButton")),
exchange2016calendar: dynamic(() => import("./exchange2016calendar/components/InstallAppButton")),
office365video: dynamic(() => import("./office365video/components/InstallAppButton")),
exchange2013calendar: dynamic(
() => import("./exchange2013calendar/components/InstallAppButton")
),
exchange2016calendar: dynamic(
() => import("./exchange2016calendar/components/InstallAppButton")
),
office365video: dynamic(
() => import("./office365video/components/InstallAppButton")
),
vital: dynamic(() => import("./vital/components/InstallAppButton")),
};
export const AppSettingsComponentsMap = {
"general-app-settings": dynamic(() =>
import("./templates/general-app-settings/components/AppSettingsInterface")
"general-app-settings": dynamic(
() =>
import("./templates/general-app-settings/components/AppSettingsInterface")
),
weather_in_your_calendar: dynamic(() =>
import("./weather_in_your_calendar/components/AppSettingsInterface")
weather_in_your_calendar: dynamic(
() => import("./weather_in_your_calendar/components/AppSettingsInterface")
),
zapier: dynamic(() => import("./zapier/components/AppSettingsInterface")),
};
export const EventTypeAddonMap = {
alby: dynamic(() => import("./alby/components/EventTypeAppCardInterface")),
basecamp3: dynamic(() => import("./basecamp3/components/EventTypeAppCardInterface")),
btcpayserver: dynamic(() => import("./btcpayserver/components/EventTypeAppCardInterface")),
closecom: dynamic(() => import("./closecom/components/EventTypeAppCardInterface")),
databuddy: dynamic(() => import("./databuddy/components/EventTypeAppCardInterface")),
fathom: dynamic(() => import("./fathom/components/EventTypeAppCardInterface")),
basecamp3: dynamic(
() => import("./basecamp3/components/EventTypeAppCardInterface")
),
btcpayserver: dynamic(
() => import("./btcpayserver/components/EventTypeAppCardInterface")
),
closecom: dynamic(
() => import("./closecom/components/EventTypeAppCardInterface")
),
databuddy: dynamic(
() => import("./databuddy/components/EventTypeAppCardInterface")
),
fathom: dynamic(
() => import("./fathom/components/EventTypeAppCardInterface")
),
ga4: dynamic(() => import("./ga4/components/EventTypeAppCardInterface")),
giphy: dynamic(() => import("./giphy/components/EventTypeAppCardInterface")),
gtm: dynamic(() => import("./gtm/components/EventTypeAppCardInterface")),
hitpay: dynamic(() => import("./hitpay/components/EventTypeAppCardInterface")),
hubspot: dynamic(() => import("./hubspot/components/EventTypeAppCardInterface")),
insihts: dynamic(() => import("./insihts/components/EventTypeAppCardInterface")),
matomo: dynamic(() => import("./matomo/components/EventTypeAppCardInterface")),
metapixel: dynamic(() => import("./metapixel/components/EventTypeAppCardInterface")),
"mock-payment-app": dynamic(() => import("./mock-payment-app/components/EventTypeAppCardInterface")),
paypal: dynamic(() => import("./paypal/components/EventTypeAppCardInterface")),
"pipedrive-crm": dynamic(() => import("./pipedrive-crm/components/EventTypeAppCardInterface")),
plausible: dynamic(() => import("./plausible/components/EventTypeAppCardInterface")),
posthog: dynamic(() => import("./posthog/components/EventTypeAppCardInterface")),
qr_code: dynamic(() => import("./qr_code/components/EventTypeAppCardInterface")),
salesforce: dynamic(() => import("./salesforce/components/EventTypeAppCardInterface")),
stripepayment: dynamic(() => import("./stripepayment/components/EventTypeAppCardInterface")),
"booking-pages-tag": dynamic(() =>
import("./templates/booking-pages-tag/components/EventTypeAppCardInterface")
hitpay: dynamic(
() => import("./hitpay/components/EventTypeAppCardInterface")
),
"event-type-app-card": dynamic(() =>
import("./templates/event-type-app-card/components/EventTypeAppCardInterface")
hubspot: dynamic(
() => import("./hubspot/components/EventTypeAppCardInterface")
),
insihts: dynamic(
() => import("./insihts/components/EventTypeAppCardInterface")
),
matomo: dynamic(
() => import("./matomo/components/EventTypeAppCardInterface")
),
metapixel: dynamic(
() => import("./metapixel/components/EventTypeAppCardInterface")
),
"mock-payment-app": dynamic(
() => import("./mock-payment-app/components/EventTypeAppCardInterface")
),
paypal: dynamic(
() => import("./paypal/components/EventTypeAppCardInterface")
),
"pipedrive-crm": dynamic(
() => import("./pipedrive-crm/components/EventTypeAppCardInterface")
),
plausible: dynamic(
() => import("./plausible/components/EventTypeAppCardInterface")
),
posthog: dynamic(
() => import("./posthog/components/EventTypeAppCardInterface")
),
qr_code: dynamic(
() => import("./qr_code/components/EventTypeAppCardInterface")
),
salesforce: dynamic(
() => import("./salesforce/components/EventTypeAppCardInterface")
),
stripepayment: dynamic(
() => import("./stripepayment/components/EventTypeAppCardInterface")
),
"booking-pages-tag": dynamic(
() =>
import(
"./templates/booking-pages-tag/components/EventTypeAppCardInterface"
)
),
"event-type-app-card": dynamic(
() =>
import(
"./templates/event-type-app-card/components/EventTypeAppCardInterface"
)
),
twipla: dynamic(
() => import("./twipla/components/EventTypeAppCardInterface")
),
twipla: dynamic(() => import("./twipla/components/EventTypeAppCardInterface")),
umami: dynamic(() => import("./umami/components/EventTypeAppCardInterface")),
"zoho-bigin": dynamic(() => import("./zoho-bigin/components/EventTypeAppCardInterface")),
zohocrm: dynamic(() => import("./zohocrm/components/EventTypeAppCardInterface")),
"zoho-bigin": dynamic(
() => import("./zoho-bigin/components/EventTypeAppCardInterface")
),
zohocrm: dynamic(
() => import("./zohocrm/components/EventTypeAppCardInterface")
),
};
export const EventTypeSettingsMap = {
alby: dynamic(() => import("./alby/components/EventTypeAppSettingsInterface")),
basecamp3: dynamic(() => import("./basecamp3/components/EventTypeAppSettingsInterface")),
btcpayserver: dynamic(() => import("./btcpayserver/components/EventTypeAppSettingsInterface")),
databuddy: dynamic(() => import("./databuddy/components/EventTypeAppSettingsInterface")),
fathom: dynamic(() => import("./fathom/components/EventTypeAppSettingsInterface")),
alby: dynamic(
() => import("./alby/components/EventTypeAppSettingsInterface")
),
basecamp3: dynamic(
() => import("./basecamp3/components/EventTypeAppSettingsInterface")
),
btcpayserver: dynamic(
() => import("./btcpayserver/components/EventTypeAppSettingsInterface")
),
databuddy: dynamic(
() => import("./databuddy/components/EventTypeAppSettingsInterface")
),
fathom: dynamic(
() => import("./fathom/components/EventTypeAppSettingsInterface")
),
ga4: dynamic(() => import("./ga4/components/EventTypeAppSettingsInterface")),
giphy: dynamic(() => import("./giphy/components/EventTypeAppSettingsInterface")),
giphy: dynamic(
() => import("./giphy/components/EventTypeAppSettingsInterface")
),
gtm: dynamic(() => import("./gtm/components/EventTypeAppSettingsInterface")),
hitpay: dynamic(() => import("./hitpay/components/EventTypeAppSettingsInterface")),
metapixel: dynamic(() => import("./metapixel/components/EventTypeAppSettingsInterface")),
paypal: dynamic(() => import("./paypal/components/EventTypeAppSettingsInterface")),
plausible: dynamic(() => import("./plausible/components/EventTypeAppSettingsInterface")),
qr_code: dynamic(() => import("./qr_code/components/EventTypeAppSettingsInterface")),
stripepayment: dynamic(() => import("./stripepayment/components/EventTypeAppSettingsInterface")),
hitpay: dynamic(
() => import("./hitpay/components/EventTypeAppSettingsInterface")
),
metapixel: dynamic(
() => import("./metapixel/components/EventTypeAppSettingsInterface")
),
paypal: dynamic(
() => import("./paypal/components/EventTypeAppSettingsInterface")
),
plausible: dynamic(
() => import("./plausible/components/EventTypeAppSettingsInterface")
),
qr_code: dynamic(
() => import("./qr_code/components/EventTypeAppSettingsInterface")
),
stripepayment: dynamic(
() => import("./stripepayment/components/EventTypeAppSettingsInterface")
),
};
@@ -52,7 +52,6 @@ import { appKeysSchema as zoho_bigin_zod_ts } from "./zoho-bigin/zod";
import { appKeysSchema as zohocalendar_zod_ts } from "./zohocalendar/zod";
import { appKeysSchema as zohocrm_zod_ts } from "./zohocrm/zod";
import { appKeysSchema as zoomvideo_zod_ts } from "./zoomvideo/zod";
export const appKeysSchemas = {
alby: alby_zod_ts,
basecamp3: basecamp3_zod_ts,
@@ -111,7 +111,6 @@ import zoho_bigin_config_json from "./zoho-bigin/config.json";
import zohocalendar_config_json from "./zohocalendar/config.json";
import zohocrm_config_json from "./zohocrm/config.json";
import { metadata as zoomvideo__metadata_ts } from "./zoomvideo/_metadata";
export const appStoreMetadata = {
alby: alby_config_json,
amie: amie_config_json,
@@ -52,7 +52,6 @@ import { appDataSchema as zoho_bigin_zod_ts } from "./zoho-bigin/zod";
import { appDataSchema as zohocalendar_zod_ts } from "./zohocalendar/zod";
import { appDataSchema as zohocrm_zod_ts } from "./zohocrm/zod";
import { appDataSchema as zoomvideo_zod_ts } from "./zoomvideo/zod";
export const appDataSchemas = {
alby: alby_zod_ts,
basecamp3: basecamp3_zod_ts,
@@ -46,7 +46,6 @@ import webex_config_json from "./webex/config.json";
import whatsapp_config_json from "./whatsapp/config.json";
import whereby_config_json from "./whereby/config.json";
import { metadata as zoomvideo__metadata_ts } from "./zoomvideo/_metadata";
export const appStoreMetadata = {
campfire: campfire_config_json,
dailyvideo: dailyvideo__metadata_ts,
-16
View File
@@ -1,16 +0,0 @@
import { forbid } from "@calcom/eslint-config/base";
import { config } from "@calcom/eslint-config/react-internal";
export default [
...config,
forbid({
from: "../features/**",
target: ".",
message: "app-store package should not import from features to avoid circular dependencies.",
}),
forbid({
from: "../trpc/**",
target: ".",
message: "app-store package should not import from trpc to avoid circular dependencies.",
}),
];
+3 -4
View File
@@ -10,9 +10,9 @@
"scripts": {
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"lint": "eslint .",
"lint:fix": "eslint .",
"lint:report": "eslint . --format json --output-file ../../lint-results/app-store.json"
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"lint:report": "biome lint --reporter json . > ../../lint-results/app-store.json"
},
"dependencies": {
"@calcom/dailyvideo": "workspace:*",
@@ -33,7 +33,6 @@
"zod": "^3.0.0"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@calcom/types": "workspace:*"
}
}
@@ -12,11 +12,10 @@
"react-awesome-query-builder": "5.1.2"
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint ."
"lint": "biome lint .",
"lint:fix": "biome lint --write ."
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@calcom/types": "workspace:*",
"@types/json-logic-js": "1.2.1"
}
-15
View File
@@ -5,12 +5,7 @@
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"files": [
"eslint-preset.js",
"prettier-preset.js"
],
"dependencies": {
"@calcom/eslint-plugin-eslint": "workspace:*",
"@todesktop/tailwind-variants": "1.0.1",
"tailwind-scrollbar": "4.0.2",
"tailwindcss-radix": "4.0.2",
@@ -18,16 +13,6 @@
},
"devDependencies": {
"@tailwindcss/typography": "0.5.4",
"@trivago/prettier-plugin-sort-imports": "4.1.1",
"@typescript-eslint/eslint-plugin": "5.52.0",
"@typescript-eslint/parser": "5.52.0",
"eslint-config-next": "13.5.11",
"eslint-config-prettier": "8.6.0",
"eslint-config-turbo": "0.0.7",
"eslint-plugin-playwright": "0.12.0",
"eslint-plugin-prettier": "4.2.1",
"prettier": "2.8.7",
"prettier-plugin-tailwindcss": "0.2.5",
"typescript": "5.9.2"
}
}
-41
View File
@@ -1,41 +0,0 @@
module.exports = {
bracketSpacing: true,
bracketSameLine: true,
singleQuote: false,
jsxSingleQuote: false,
trailingComma: "es5",
semi: true,
printWidth: 110,
arrowParens: "always",
endOfLine: "auto",
importOrder: [
// Mocks must be at the top as they contain vi.mock calls
"(.*)/__mocks__/(.*)",
// bookingScenario contains prismock that must be imported asap
"(.*)bookingScenario(.*)",
"<THIRD_PARTY_MODULES>",
"^@(calcom|ee)/(.*)$",
"^@lib/(.*)$",
"^@components/(.*)$",
"^@(server|trpc)/(.*)$",
"^~/(.*)$",
"^[./]",
],
importOrderSeparation: true,
plugins: [
"@trivago/prettier-plugin-sort-imports",
/**
* **NOTE** tailwind plugin must come last!
* @see https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins
*/
"prettier-plugin-tailwindcss",
],
overrides: [
{
files: ["apps/website/lib/utils/wordlist/wordlist.ts"],
options: {
quoteProps: "consistent",
},
},
],
};
+2 -2
View File
@@ -9,8 +9,8 @@
"./hooks/*": "./src/hooks/*.ts"
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"registry:pull": "ts-node ../../scripts/pull-coss-ui-components.ts"
+2 -2
View File
@@ -28,8 +28,8 @@
"dev-real": "vite dev --port 3100",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"lint": "eslint --ext .ts,.js src",
"lint:fix": "eslint --ext .ts,.js src --fix",
"lint": "biome lint src",
"lint:fix": "biome lint --write src",
"embed-tests": "yarn playwright test --config=playwright/config/playwright.config.ts",
"embed-tests-quick": "QUICK=true yarn embed-tests",
"embed-tests-update-snapshots:ci": "yarn embed-tests-quick --update-snapshots",
@@ -269,6 +269,10 @@ export const useEmbedType = () => {
};
function makeBodyVisible() {
// Guard against test environment teardown where document may no longer exist
if (typeof document === "undefined" || !document.body) {
return;
}
if (document.body.style.visibility !== "visible") {
document.body.style.visibility = "visible";
}
@@ -9,7 +9,7 @@ import type {
} from "../../types";
import { runAsap, log } from "./utils";
export const enum EMBED_IFRAME_STATE {
export enum EMBED_IFRAME_STATE {
NOT_INITIALIZED,
INITIALIZED,
}
+1 -2
View File
@@ -15,7 +15,7 @@
"preview": "vite preview",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"lint": "eslint --ext .ts,.js,.tsx,.jsx ./src",
"lint": "biome lint ./src",
"embed-tests": "yarn playwright test --config=./playwright/config/playwright.config.ts",
"embed-tests-quick": "QUICK=true yarn embed-tests",
"embed-tests-update-snapshots:ci": "yarn embed-tests-quick --update-snapshots",
@@ -44,7 +44,6 @@
}
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@playwright/test": "1.57.0",
"@types/react": "18.0.26",
"@types/react-dom": "18.2.6",
+1 -2
View File
@@ -15,7 +15,7 @@
"build": "rm -rf dist && vite build && tsc --emitDeclarationOnly --declarationDir dist",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"lint": "eslint --ext .ts,.js src",
"lint": "biome lint src",
"withEmbedPublishEnv": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn",
"prepack": "yarn ../../../ lint --filter='@calcom/embed-snippet' && yarn withEmbedPublishEnv build",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
@@ -25,7 +25,6 @@
],
"types": "./dist/index.d.ts",
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"typescript": "5.9.2",
"vite": "4.5.14"
},
-60
View File
@@ -1,60 +0,0 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import importPlugin from "eslint-plugin-import";
import onlyWarn from "eslint-plugin-only-warn";
import turboPlugin from "eslint-plugin-turbo";
import tseslint from "typescript-eslint";
/**
* A shared ESLint configuration for the repository.
*
* @type {import("eslint").Linter.Config}
*/
export const config = [
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
{
plugins: {
turbo: turboPlugin,
import: importPlugin,
onlyWarn,
},
rules: {
"turbo/no-undeclared-env-vars": "warn",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
},
languageOptions: {
ecmaVersion: 2021,
sourceType: "module",
},
settings: {
"import/resolver": {
typescript: true,
node: true,
},
},
},
{
ignores: ["dist/**", "**/node_modules/**", "**/.next/**"],
},
];
export function forbid({ from, target, message }) {
return {
rules: {
"import/no-restricted-paths": [
"error",
{
zones: [
{
from: [from],
target: [target],
message: message ?? `Import denied from ${target} to ${from}`,
},
],
},
],
},
};
}
-51
View File
@@ -1,51 +0,0 @@
import js from "@eslint/js";
import pluginNext from "@next/eslint-plugin-next";
import eslintConfigPrettier from "eslint-config-prettier";
import pluginReact from "eslint-plugin-react";
import pluginReactHooks from "eslint-plugin-react-hooks";
import globals from "globals";
import tseslint from "typescript-eslint";
import { config as baseConfig } from "./base.js";
/**
* A custom ESLint configuration for libraries that use Next.js.
*
* @type {import("eslint").Linter.Config}
* */
export const nextJsConfig = [
...baseConfig,
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
{
...pluginReact.configs.flat.recommended,
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
},
},
},
{
plugins: {
"@next/next": pluginNext,
},
rules: {
...pluginNext.configs.recommended.rules,
...pluginNext.configs["core-web-vitals"].rules,
},
},
{
plugins: {
"react-hooks": pluginReactHooks,
},
settings: { react: { version: "detect" } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
},
];
-30
View File
@@ -1,30 +0,0 @@
{
"name": "@calcom/eslint-config",
"version": "0.0.0",
"type": "module",
"private": true,
"exports": {
"./base": "./base.js",
"./next-js": "./next.js",
"./react-internal": "./react-internal.js"
},
"dependencies": {
"@eslint/js": "9.36.0",
"@next/eslint-plugin-next": "15.4.5",
"@typescript-eslint/eslint-plugin": "8.39.0",
"@typescript-eslint/parser": "8.39.0",
"globals": "15.15.0",
"typescript-eslint": "8.40.0"
},
"devDependencies": {
"eslint": "9.36.0",
"eslint-config-prettier": "9.1.2",
"eslint-import-resolver-typescript": "4.4.4",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-only-warn": "1.1.0",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-turbo": "2.5.5",
"typescript": "5.9.2"
}
}
-41
View File
@@ -1,41 +0,0 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import pluginReact from "eslint-plugin-react";
import pluginReactHooks from "eslint-plugin-react-hooks";
import globals from "globals";
import tseslint from "typescript-eslint";
import { config as baseConfig } from "./base.js";
/**
* A custom ESLint configuration for libraries that use React.
*
* @type {import("eslint").Linter.Config} */
export const config = [
...baseConfig,
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
...globals.browser,
},
},
},
{
plugins: {
"react-hooks": pluginReactHooks,
},
settings: { react: { version: "detect" } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
},
];
-16
View File
@@ -1,16 +0,0 @@
{
"name": "@calcom/eslint-plugin-eslint",
"sideEffects": false,
"private": true,
"version": "0.1.0",
"main": "./src/index.js",
"dependencies": {
"@typescript-eslint/parser": "5.52.0",
"@typescript-eslint/utils": "5.52.0",
"ts-node-maintained": "10.9.5"
},
"devDependencies": {
"@types/eslint": "8.4.5",
"typescript": "5.9.2"
}
}
@@ -1,4 +0,0 @@
/* eslint-disable @typescript-eslint/no-var-requires, import/no-anonymous-default-export */
export default {
recommended: require("./recommended").default,
};
@@ -1,16 +0,0 @@
const recommended = {
parser: "@typescript-eslint/parser",
parserOptions: { sourceType: "module" },
rules: {
"@calcom/eslint/deprecated-imports": "error",
"@calcom/eslint/deprecated-imports-next-router": "error",
"@calcom/eslint/avoid-web-storage": "error",
"@calcom/eslint/avoid-prisma-client-import-for-enums": "error",
"@calcom/eslint/no-prisma-include-true": "warn",
"@calcom/eslint/no-scroll-into-view-embed": "error",
"@calcom/eslint/no-direct-prisma-import": "error",
"@calcom/eslint/no-this-in-static-method": "error",
},
};
export default recommended;
-15
View File
@@ -1,15 +0,0 @@
// 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-maintained").register({
compilerOptions: {
module: "commonjs",
},
});
// re-export our rules so that eslint run by node can understand them
module.exports = {
// import our rules from the typescript file
rules: require("./rules/index.ts").default,
// import our config from the typescript file
configs: require("./configs/index.ts").default,
};
@@ -1,45 +0,0 @@
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const rule = createRule({
create(context) {
return {
ImportDeclaration(node) {
node.source.value === "@prisma/client" &&
node.importKind !== "type" &&
node.specifiers.forEach((item) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const enumType = item.imported?.name; // ts doesn't know about imported, bad type?
if (!enumType || enumType === "Prisma" || enumType === "PrismaClient") return null;
return context.report({
node: item,
loc: node.loc,
messageId: "avoid-prisma-client-import",
data: {
enumType,
},
});
});
},
};
},
name: "avoid-prisma-client-import-for-enums",
meta: {
fixable: "code",
docs: {
description: "Avoid prisma client import for enums",
recommended: "error",
},
messages: {
"avoid-prisma-client-import": `Import { {{enumType}} } from '@calcom/prisma/enums' to avoid including @prisma/client.`,
},
type: "suggestion",
schema: [],
},
defaultOptions: [],
});
export default rule;
@@ -1,127 +0,0 @@
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const rule = createRule({
create(context) {
// Track imported names from @calcom/lib/webstorage
const safeImportedNames = new Set<string>();
return {
ImportDeclaration(node) {
// Check if this is an import from the safe webstorage module
if (node.source.value === "@calcom/lib/webstorage") {
node.specifiers.forEach((specifier) => {
if (specifier.type === "ImportSpecifier") {
// Track the local name used for the import
safeImportedNames.add(specifier.local.name);
}
});
}
},
CallExpression(node) {
const webStorages = ["localStorage", "sessionStorage"];
const callee = node.callee;
// Check for window.localStorage or window.sessionStorage
if (
// Can't figure out how to fix this TS issue
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
callee.object?.object?.name === "window" &&
// Can't figure out how to fix this TS issue
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
webStorages.includes(node?.callee?.object?.property?.name)
) {
return context.report({
node: node,
loc: node.loc,
messageId: "possible-issue-with-embed",
});
}
// Check for direct localStorage or sessionStorage usage
if (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
callee.type === "MemberExpression" &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
callee.object?.type === "Identifier" &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
webStorages.includes(callee.object?.name) &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
!safeImportedNames.has(callee.object?.name)
) {
return context.report({
node: node,
loc: node.loc,
messageId: "possible-issue-with-embed",
});
}
},
// Also check for property access like localStorage.length
MemberExpression(node) {
const webStorages = ["localStorage", "sessionStorage"];
// Check for direct property access on localStorage/sessionStorage
if (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
node.object?.type === "Identifier" &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
webStorages.includes(node.object?.name) &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
!safeImportedNames.has(node.object?.name)
) {
return context.report({
node: node,
loc: node.loc,
messageId: "possible-issue-with-embed",
});
}
// Check for window.localStorage/sessionStorage property access
if (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
node.object?.type === "MemberExpression" &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
node.object?.object?.name === "window" &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
webStorages.includes(node.object?.property?.name)
) {
return context.report({
node: node,
loc: node.loc,
messageId: "possible-issue-with-embed",
});
}
},
};
},
name: "avoid-web-storage",
meta: {
fixable: "code",
docs: {
description: "Avoid deprecated imports",
recommended: "warn",
},
messages: {
"possible-issue-with-embed": `Be aware that accessing localStorage/sessionStorage throws error in Chrome Incognito mode when embed is in cross domain context. If you know what you are doing, \`import {localStorage, sessionStorage} from "@calcom/lib/webstorage"\` for safe usage. See https://github.com/calcom/cal.com/issues/2618`,
},
type: "suggestion",
schema: [],
},
defaultOptions: [],
});
export default rule;
@@ -1,38 +0,0 @@
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const rule = createRule({
name: "deprecated-imports-next-router",
meta: {
fixable: "code",
docs: {
description: "Importing router from 'next/router' is deprecated, use 'next/navigation' instead",
recommended: "error",
},
messages: {
"deprecated-next-router":
"Importing router from 'next/router' is deprecated, use 'next/navigation' instead",
},
type: "problem",
schema: [],
},
defaultOptions: [],
create(context) {
return {
ImportDeclaration(node) {
if (node.source.value === "next/router") {
context.report({
node,
messageId: "deprecated-next-router",
fix: function (fixer) {
return fixer.replaceText(node.source, "'next/navigation'");
},
});
}
},
};
},
});
export default rule;
@@ -1,41 +0,0 @@
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const rule = createRule({
create(context) {
return {
ImportDeclaration(node) {
node.specifiers.length &&
node.source.value === "dayjs" &&
node.specifiers.forEach((item) => {
if (item.local.name === "dayjs") {
return context.report({
node: item,
loc: node.loc,
messageId: "dayjs-moved",
fix: (fixer) => fixer.replaceText(node, "import dayjs from '@calcom/dayjs'"),
});
}
return null;
});
},
};
},
name: "deprecated-imports",
meta: {
fixable: "code",
docs: {
description: "Avoid deprecated imports",
recommended: "warn",
},
messages: {
"dayjs-moved": `Import dayjs from '@calcom/daysjs' to avoid plugin conflicts.`,
},
type: "suggestion",
schema: [],
},
defaultOptions: [],
});
export default rule;
-13
View File
@@ -1,13 +0,0 @@
/* eslint-disable @typescript-eslint/no-var-requires*/
import type { ESLint } from "eslint";
export default {
"deprecated-imports": require("./deprecated-imports").default,
"avoid-web-storage": require("./avoid-web-storage").default,
"avoid-prisma-client-import-for-enums": require("./avoid-prisma-client-import-for-enums").default,
"no-prisma-include-true": require("./no-prisma-include-true").default,
"deprecated-imports-next-router": require("./deprecated-imports-next-router").default,
"no-scroll-into-view-embed": require("./no-scroll-into-view-embed").default,
"no-direct-prisma-import": require("./no-direct-prisma-import").default,
"no-this-in-static-method": require("./no-this-in-static-method").default,
} as ESLint.Plugin["rules"];
@@ -1,23 +0,0 @@
import type { Rule } from "eslint";
const rule: Rule.RuleModule = {
meta: {
docs: {
description: "This rule is run on typescript!",
},
},
create: (context) => {
return {
VariableDeclarator: (node) => {
if (node.id.type === "Identifier" && node.id.name !== "bla") {
context.report({
node,
message: 'All variabled should be named "bla"!',
});
}
},
};
},
};
export default rule;
@@ -1,43 +0,0 @@
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const rule = createRule({
create(context) {
return {
ImportDeclaration(node) {
if (node.source.value === "@prisma/client") {
return context.report({
node,
messageId: "no-direct-prisma-import",
data: {},
fix(fixer) {
return fixer.replaceText(
node.source,
node.source.raw
.replace('"@prisma/client"', '"@calcom/prisma/client"')
.replace("'@prisma/client'", "'@calcom/prisma/client'")
);
},
});
}
},
};
},
name: "no-direct-prisma-import",
meta: {
fixable: "code",
docs: {
description: "Prevent direct imports from @prisma/client",
recommended: "error",
},
messages: {
"no-direct-prisma-import": `Direct imports from '@prisma/client' are not allowed. Use '@calcom/prisma/client' instead.`,
},
type: "problem",
schema: [],
},
defaultOptions: [],
});
export default rule;
@@ -1,100 +0,0 @@
import type { TSESTree } from "@typescript-eslint/utils";
import { ESLintUtils } from "@typescript-eslint/utils";
import type { ReportDescriptor } from "@typescript-eslint/utils/dist/ts-eslint";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const assesIncludePropertyIncludesTrue = (
includeProperty: TSESTree.Property,
reporter: { (reportObj: ReportDescriptor<"no-prisma-include-true">): void }
) => {
if (includeProperty.value.type === "ObjectExpression") {
includeProperty.value.properties.forEach((childProperty) => {
if (
childProperty.type === "Property" &&
childProperty.value.type === "Literal" &&
childProperty.value.value === true
) {
reporter({
node: childProperty,
messageId: "no-prisma-include-true",
});
}
});
}
};
const searchIncludeProperty = (
property: TSESTree.Property,
reporter: { (reportObj: ReportDescriptor<"no-prisma-include-true">): void }
) => {
if (property.type === "Property") {
// If property is include, check if it has a child property with value true
if (property.key.type === "Identifier" && property.key.name === "include") {
assesIncludePropertyIncludesTrue(property, reporter);
}
// If property value is also an object, recursively search for include property
if (property.value.type === "ObjectExpression") {
property.value.properties.forEach((childProperty) => {
if (childProperty.type === "Property") {
searchIncludeProperty(childProperty, reporter);
}
});
}
}
};
const rule = createRule({
create: function (context) {
return {
CallExpression(node) {
if (!(node.callee as TSESTree.MemberExpression).property) {
return null;
}
const nodeName = ((node.callee as TSESTree.MemberExpression).property as TSESTree.Identifier).name;
if (
!["findUnique", "findUniqueOrThrow", "findFirst", "findFirstOrThrow", "findMany"].includes(nodeName)
) {
return null;
}
const nodeArgs = node.arguments[0] as TSESTree.ObjectExpression;
if (!nodeArgs) {
return null;
}
const backReporter = (reportObj: ReportDescriptor<"no-prisma-include-true">) => {
context.report(reportObj);
};
nodeArgs.properties?.forEach((property) => {
if (property.type === "Property") {
searchIncludeProperty(property, backReporter);
}
});
return null;
},
};
},
name: "no-prisma-include-true",
meta: {
type: "problem",
docs: {
description:
"Disallow passing argument object with include: { AnyPropertyName: true } to prisma methods",
recommended: "error",
},
messages: {
"no-prisma-include-true": `Do not pass argument object with include: { AnyPropertyName: true } to prisma methods`,
},
fixable: "code",
schema: [],
},
defaultOptions: [],
});
export default rule;
@@ -1,48 +0,0 @@
import type { TSESTree } from "@typescript-eslint/utils";
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
export default createRule({
name: "no-scroll-into-view-embed",
meta: {
docs: {
description: "Disallow usage of scrollIntoView and scrollIntoViewSmooth in embed mode",
recommended: "error",
},
messages: {
noScrollIntoViewForEmbed:
"Make sure to call scrollIntoView/scrollIntoViewSmooth conditionally if it is called without user action. Use useIsEmbed() to detect if embed mode and then don't call it for embed case.",
},
type: "problem",
schema: [],
},
defaultOptions: [],
create(context) {
return {
CallExpression(node: TSESTree.CallExpression) {
const { callee } = node;
if (callee.type === "MemberExpression") {
if (
callee.property.type === "Identifier" &&
(callee.property.name === "scrollIntoView" || callee.property.name === "scrollIntoViewSmooth")
) {
context.report({
node,
messageId: "noScrollIntoViewForEmbed",
});
}
} else if (
callee.type === "Identifier" &&
(callee.name === "scrollIntoView" || callee.name === "scrollIntoViewSmooth")
) {
context.report({
node,
messageId: "noScrollIntoViewForEmbed",
});
}
},
};
},
});
@@ -1,109 +0,0 @@
import type { TSESTree } from "@typescript-eslint/utils";
import { ESLintUtils } from "@typescript-eslint/utils";
const createRule = ESLintUtils.RuleCreator((name) => `https://developer.cal.com/eslint/rule/${name}`);
const rule = createRule({
create(context) {
let currentMethodIsStatic = false;
let currentClassName = "";
return {
MethodDefinition(node) {
if (node.static && node.key.type === "Identifier") {
currentMethodIsStatic = true;
if (node.parent?.type === "ClassBody" && node.parent.parent?.type === "ClassDeclaration") {
const classNode = node.parent.parent as TSESTree.ClassDeclaration;
if (classNode.id?.name) {
currentClassName = classNode.id.name;
}
}
}
},
"MethodDefinition:exit"(node: TSESTree.MethodDefinition) {
if (node.static) {
currentMethodIsStatic = false;
currentClassName = "";
}
},
MemberExpression(node) {
if (
currentMethodIsStatic &&
node.object.type === "ThisExpression" &&
node.property.type === "Identifier"
) {
const parent = node.parent;
const isPassedToCallback =
parent?.type === "CallExpression" &&
parent.arguments.includes(node) &&
parent.callee.type === "MemberExpression" &&
parent.callee.property.type === "Identifier" &&
["map", "filter", "forEach", "reduce", "find", "some", "every"].includes(
parent.callee.property.name
);
const isVariableAssignment = parent?.type === "VariableDeclarator" && parent.init === node;
const isObjectProperty = parent?.type === "Property" && parent.value === node;
const isArrayElement = parent?.type === "ArrayExpression" && parent.elements.includes(node);
const isFunctionArgument =
parent?.type === "CallExpression" &&
parent.arguments.includes(node) &&
!(
parent.callee.type === "MemberExpression" &&
parent.callee.property.type === "Identifier" &&
["map", "filter", "forEach", "reduce", "find", "some", "every"].includes(
parent.callee.property.name
)
);
const isReturnStatement = parent?.type === "ReturnStatement" && parent.argument === node;
if (
isPassedToCallback ||
isVariableAssignment ||
isObjectProperty ||
isArrayElement ||
isFunctionArgument ||
isReturnStatement
) {
context.report({
node,
messageId: "no-this-in-static-method",
data: {
className: currentClassName,
methodName: node.property.name,
},
fix(fixer) {
if (currentClassName && node.property.type === "Identifier") {
return fixer.replaceText(node, `${currentClassName}.${node.property.name}`);
}
return null;
},
});
}
}
},
};
},
name: "no-this-in-static-method",
meta: {
type: "problem",
docs: {
description: "Disallow using 'this' to reference static methods within static methods",
recommended: "error",
},
messages: {
"no-this-in-static-method":
"Do not use 'this.{{methodName}}' in static methods. Use '{{className}}.{{methodName}}' instead to avoid context loss when passed to callbacks.",
},
fixable: "code",
schema: [],
},
defaultOptions: [],
});
export default rule;
-11
View File
@@ -1,11 +0,0 @@
import { forbid } from "@calcom/eslint-config/base";
import { config } from "@calcom/eslint-config/base";
export default [
...config,
forbid({
from: "../trpc/**",
target: ".",
message: "features package should not import from trpc to avoid circular dependencies.",
}),
];
+2 -1
View File
@@ -7,7 +7,7 @@
"version": "1.0.0",
"main": "index.ts",
"scripts": {
"lint": "eslint .",
"lint": "biome lint .",
"dev:trigger": "npx trigger.dev@latest dev --analyze",
"deploy:trigger": "npx trigger.dev@latest deploy"
},
@@ -30,6 +30,7 @@
"react-select": "5.8.0",
"react-sticky-box": "2.0.4",
"recharts": "3.0.2",
"stripe": "9.16.0",
"stripe-event-types": "3.1.0",
"web-push": "3.6.7",
"zustand": "4.5.2"
+82 -23
View File
@@ -1,4 +1,4 @@
import React from "react";
import type React from "react";
import { CAL_URL, LOGO, WEBAPP_URL } from "./constants";
@@ -47,7 +47,8 @@ const joinMultipleNames = (names: string[] = []) => {
return `${names.length > 0 ? `${names.join(", ")} & ${lastName}` : lastName}`;
};
const makeAbsoluteUrl = (url: string) => (/^https?:\/\//.test(url) ? url : `${CAL_URL}${url}`);
const makeAbsoluteUrl = (url: string) =>
/^https?:\/\//.test(url) ? url : `${CAL_URL}${url}`;
const OG_ASSETS = {
meeting: {
@@ -81,12 +82,20 @@ export const getOGImageVersion = async (
...(additionalInputs ?? {}),
};
const content = JSON.stringify(versionInputs, Object.keys(versionInputs).sort());
const content = JSON.stringify(
versionInputs,
Object.keys(versionInputs).sort()
);
// Use Web Crypto API instead of Node.js crypto for Edge Runtime compatibility (`/api/social/og/image` is an Edge Runtime route)
const hashBuffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(content));
const hashBuffer = await crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode(content)
);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
const hashHex = hashArray
.map((b) => b.toString(16).padStart(2, "0"))
.join("");
return hashHex.substring(0, 8);
};
@@ -147,7 +156,10 @@ export const constructAppImage = async ({
return encodeURIComponent(`/api/social/og/image?${params.toString()}`);
};
export const constructGenericImage = async ({ title, description }: GenericImageProps): Promise<string> => {
export const constructGenericImage = async ({
title,
description,
}: GenericImageProps): Promise<string> => {
const params = new URLSearchParams({
type: "generic",
title,
@@ -159,7 +171,11 @@ export const constructGenericImage = async ({ title, description }: GenericImage
return encodeURIComponent(`/api/social/og/image?${params.toString()}`);
};
const Wrapper = ({ children, variant = "light", rotateBackground }: WrapperProps) => (
const Wrapper = ({
children,
variant = "light",
rotateBackground,
}: WrapperProps) => (
<div tw="flex w-full h-full">
<img
tw="flex absolute left-0 top-0 w-full h-[110%]"
@@ -169,7 +185,9 @@ const Wrapper = ({ children, variant = "light", rotateBackground }: WrapperProps
width="1200"
height="600"
/>
<div tw="flex flex-col w-full h-full px-[80px] py-[70px] items-start justify-center">{children}</div>
<div tw="flex flex-col w-full h-full px-[80px] py-[70px] items-start justify-center">
{children}
</div>
</div>
);
@@ -186,7 +204,8 @@ export const Meeting = ({ title, users = [], profile }: MeetingImageProps) => {
// any non existing images for dynamic collectives, while at the same time removing them from
// the names list, because the profile name of that event is a concatenation of all names.
const attendees = (profile.image ? [profile, ...users] : users).filter(
(value, index, self) => self.findIndex((v) => v.name === value.name) == index
(value, index, self) =>
self.findIndex((v) => v.name === value.name) === index
);
// Construct list of avatar urls, removes duplicates and empty profile images
@@ -199,15 +218,26 @@ export const Meeting = ({ title, users = [], profile }: MeetingImageProps) => {
// In case there is NO other attendee than the single meeting profile without an image, we add
// that name back in here, since the event probably is a round robin event.
const names = attendees.length > 0 ? attendees.map((user) => user.name) : [profile.name];
const names =
attendees.length > 0 ? attendees.map((user) => user.name) : [profile.name];
return (
<Wrapper variant={config.variant}>
<div tw="h-full flex flex-col justify-start">
<div tw="flex items-center justify-center" style={{ fontFamily: "cal", fontWeight: 300 }}>
<img src={`${WEBAPP_URL}/${config.logo}`} width={config.logoWidth} alt="Logo" />
<div
tw="flex items-center justify-center"
style={{ fontFamily: "cal", fontWeight: 300 }}
>
<img
src={`${WEBAPP_URL}/${config.logo}`}
width={config.logoWidth}
alt="Logo"
/>
{avatars.length > 0 && (
<div style={{ color: "#111827" }} tw="font-bold text-[92px] mx-8 bottom-2">
<div
style={{ color: "#111827" }}
tw="font-bold text-[92px] mx-8 bottom-2"
>
/
</div>
)}
@@ -217,28 +247,44 @@ export const Meeting = ({ title, users = [], profile }: MeetingImageProps) => {
tw="rounded-full mr-[-36px] border-[6px] border-[#CDCED2]"
key={avatar}
src={avatar}
alt="Profile picture"
alt="Profile"
width={config.avatarSize}
height={config.avatarSize}
/>
))}
{avatars.length > 3 && (
<div
tw={`flex items-center justify-center w-[${config.avatarSize}px] h-[${config.avatarSize}px] rounded-full bg-black text-inverted text-[54px] font-bold`}>
<span tw="flex top-[-5px] left-[-5px]">+{avatars.length - 3}</span>
tw={`flex items-center justify-center w-[${config.avatarSize}px] h-[${config.avatarSize}px] rounded-full bg-black text-inverted text-[54px] font-bold`}
>
<span tw="flex top-[-5px] left-[-5px]">
+{avatars.length - 3}
</span>
</div>
)}
</div>
</div>
<div style={{ color: "#111827" }} tw="relative flex text-[54px] w-full flex-col mt-auto">
<div
style={{ color: "#111827" }}
tw="relative flex text-[54px] w-full flex-col mt-auto"
>
<div
tw="flex w-[1040px] overflow-hidden"
style={{ whiteSpace: "nowrap", fontFamily: "cal", textOverflow: "ellipsis" }}>
style={{
whiteSpace: "nowrap",
fontFamily: "cal",
textOverflow: "ellipsis",
}}
>
Meet {joinMultipleNames(names)}
</div>
<div
tw="flex mt-3 w-[1040px] overflow-hidden"
style={{ whiteSpace: "nowrap", fontFamily: "inter", textOverflow: "ellipsis" }}>
style={{
whiteSpace: "nowrap",
fontFamily: "inter",
textOverflow: "ellipsis",
}}
>
{title}
</div>
</div>
@@ -309,7 +355,10 @@ export const App = ({ name, description, logoUrl }: AppImageProps) => {
</div>
</div>
<div style={{ color: "#111827" }} tw="flex mt-auto w-full flex-col">
<div tw="flex text-[64px] mb-7" style={{ fontFamily: "cal", fontWeight: 600 }}>
<div
tw="flex text-[64px] mb-7"
style={{ fontFamily: "cal", fontWeight: 600 }}
>
{name}
</div>
<div tw="flex text-[36px]" style={{ fontFamily: "inter" }}>
@@ -331,11 +380,21 @@ export const Generic = ({ title, description }: GenericImageProps) => {
return (
<Wrapper variant={config.variant}>
<div tw="h-full flex flex-col justify-start">
<div tw="flex items-center justify-center" style={{ fontFamily: "cal", fontWeight: 300 }}>
<img src={`${WEBAPP_URL}/${config.logo}`} width={config.logoWidth} alt="Logo" />
<div
tw="flex items-center justify-center"
style={{ fontFamily: "cal", fontWeight: 300 }}
>
<img
src={`${WEBAPP_URL}/${config.logo}`}
width={config.logoWidth}
alt="Logo"
/>
</div>
<div style={{ color: "#111827" }} tw="relative flex text-[54px] w-full flex-col mt-auto">
<div
style={{ color: "#111827" }}
tw="relative flex text-[54px] w-full flex-col mt-auto"
>
<div tw="flex w-[1040px]" style={{ fontFamily: "cal" }}>
{title}
</div>
@@ -1,6 +1,6 @@
import type { AppMeta } from "@calcom/types/App";
export const shouldRedirectToAppOnboarding = (appMetadata: AppMeta) => {
const hasEventTypes = appMetadata?.extendsFeature == "EventType";
const hasEventTypes = appMetadata?.extendsFeature === "EventType";
return hasEventTypes;
};
-39
View File
@@ -1,39 +0,0 @@
import { forbid } from "@calcom/eslint-config/base";
import { config } from "@calcom/eslint-config/base";
export default [
...config,
forbid({
from: "../app-store/**",
target: ".",
message: "lib package should not import from app-store to avoid circular dependencies.",
}),
forbid({
from: "../features/**",
target: ".",
message: "lib package should not import from features to avoid circular dependencies.",
}),
forbid({
from: "../trpc/**",
target: ".",
message: "lib package should not import from trpc to avoid circular dependencies.",
}),
{
// Block @trpc/server imports to keep packages/lib framework-agnostic.
// defaultResponder.ts is temporarily excluded until it can be refactored.
ignores: ["server/defaultResponder.ts", "server/defaultResponder.test.ts"],
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "@trpc/server",
message: "packages/lib should not import from @trpc/server to keep it framework-agnostic.",
},
],
},
],
},
},
];
+3 -4
View File
@@ -5,9 +5,9 @@
"version": "0.0.0",
"license": "MIT",
"scripts": {
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
"lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
"lint:report": "eslint . --format json --output-file ../../lint-results/app-store.json"
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"lint:report": "biome lint --reporter json . > ../../lint-results/lib.json"
},
"dependencies": {
"@calcom/config": "workspace:*",
@@ -30,7 +30,6 @@
"uuid": "8.3.2"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@calcom/tsconfig": "workspace:*",
"@calcom/types": "workspace:*",
"@faker-js/faker": "7.6.0",
+18 -7
View File
@@ -1,8 +1,12 @@
import { createHmac } from "crypto";
import { createHmac } from "node:crypto";
// 262992 minutes is 6 months
export function generateVideoToken(recordingId: string, expiresInMinutes = 262992) {
const secret = process.env.CAL_VIDEO_RECORDING_TOKEN_SECRET || "default-secret-change-me";
export function generateVideoToken(
recordingId: string,
expiresInMinutes = 262992
) {
const secret =
process.env.CAL_VIDEO_RECORDING_TOKEN_SECRET || "default-secret-change-me";
const expires = Date.now() + expiresInMinutes * 60 * 1000;
const payload = `${recordingId}:${expires}`;
@@ -11,18 +15,25 @@ export function generateVideoToken(recordingId: string, expiresInMinutes = 26299
return `${payload}:${hmac}`;
}
export function verifyVideoToken(token: string): { valid: boolean; recordingId?: string } {
export function verifyVideoToken(token: string): {
valid: boolean;
recordingId?: string;
} {
try {
const [recordingId, expires, receivedHmac] = token.split(":");
const secret = process.env.CAL_VIDEO_RECORDING_TOKEN_SECRET || "default-secret-change-me";
const secret =
process.env.CAL_VIDEO_RECORDING_TOKEN_SECRET ||
"default-secret-change-me";
if (Date.now() > parseInt(expires)) {
if (Date.now() > parseInt(expires, 10)) {
return { valid: false };
}
// Verify HMAC
const payload = `${recordingId}:${expires}`;
const expectedHmac = createHmac("sha256", secret).update(payload).digest("hex");
const expectedHmac = createHmac("sha256", secret)
.update(payload)
.digest("hex");
if (receivedHmac !== expectedHmac) {
return { valid: false };
@@ -1,3 +0,0 @@
import { nextJsConfig } from "@calcom/eslint-config/next-js";
export default nextJsConfig;
+1 -2
View File
@@ -7,7 +7,7 @@
"dev": "PORT=4321 next dev",
"build": "next build",
"start": "next start",
"lint": "eslint .",
"lint": "biome lint .",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui"
},
@@ -21,7 +21,6 @@
"react-select": "5.8.0"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@playwright/test": "1.57.0",
"@tailwindcss/postcss": "4.1.15",
"@types/node": "20.17.23",
@@ -13,7 +13,7 @@ export type Data = {
};
// example endpoint to endpoint to fetch managed users
export default async function handler(req: NextApiRequest, res: NextApiResponse<Data>) {
export default async function handler(_req: NextApiRequest, res: NextApiResponse<Data>) {
const existingUsers = await prisma.user.findMany({ orderBy: { createdAt: "desc" } });
if (existingUsers && existingUsers.length > 2) {
return res.status(200).json({
-6
View File
@@ -1,6 +0,0 @@
const rootConfig = require("../../config/prettier-preset");
module.exports = {
...rootConfig,
importOrderParserPlugins: ["typescript", "decorators-legacy"],
};
-14
View File
@@ -1,14 +0,0 @@
import { config } from "@calcom/eslint-config/base";
import { forbid } from "@calcom/eslint-config/base";
export default [
...config,
{
ignores: ["./types/**"],
},
forbid({
from: "../apps/web/**",
target: ".",
message: "trpc package should not import from apps/web to avoid circular dependencies.",
}),
];
+2 -3
View File
@@ -7,8 +7,8 @@
"version": "1.0.0",
"main": "index.ts",
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . ",
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"build": "yarn build:server && yarn build:react",
"build:server": "yarn tsc --project tsconfig.server.json",
"build:react": "yarn tsc --project tsconfig.react.json"
@@ -30,7 +30,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@tanstack/react-query": "5.17.19",
"@types/cookie": "0.6.0",
"@types/uuid": "8.3.4",
+156 -156
View File
@@ -1,159 +1,159 @@
// This file is generated by yarn run build:icons
export type IconName =
| "activity"
| "arrow-down"
| "arrow-left"
| "arrow-right"
| "arrow-up-right"
| "arrow-up"
| "asterisk"
| "at-sign"
| "atom"
| "badge-check"
| "ban"
| "bell"
| "binary"
| "blocks"
| "bold"
| "book-open-check"
| "book-open"
| "book-user"
| "book"
| "bookmark"
| "building"
| "calendar-check-2"
| "calendar-days"
| "calendar-heart"
| "calendar-range"
| "calendar-search"
| "calendar-x-2"
| "calendar"
| "chart-bar"
| "chart-line"
| "check-check"
| "check"
| "chevron-down"
| "chevron-left"
| "chevron-right"
| "chevron-up"
| "chevrons-down-up"
| "chevrons-left"
| "chevrons-right"
| "chevrons-up-down"
| "circle-alert"
| "circle-arrow-up"
| "circle-check-big"
| "circle-check"
| "circle-help"
| "circle-plus"
| "circle-x"
| "circle"
| "clipboard-check"
| "clipboard"
| "clock"
| "code"
| "columns-3"
| "command"
| "contact"
| "copy"
| "corner-down-left"
| "corner-down-right"
| "credit-card"
| "disc"
| "dot"
| "download"
| "ellipsis-vertical"
| "ellipsis"
| "external-link"
| "eye-off"
| "eye"
| "file-down"
| "file-text"
| "file"
| "filter"
| "fingerprint"
| "flag"
| "folder"
| "gift"
| "git-merge"
| "github"
| "globe"
| "grid-3x3"
| "handshake"
| "info"
| "italic"
| "key"
| "layers"
| "layout-dashboard"
| "link-2"
| "link"
| "list-filter"
| "loader"
| "lock-open"
| "lock"
| "log-out"
| "mail-open"
| "mail"
| "map-pin"
| "map"
| "menu"
| "message-circle"
| "messages-square"
| "mic-off"
| "mic"
| "monitor"
| "moon"
| "paintbrush"
| "paperclip"
| "pause"
| "pencil"
| "phone-call"
| "phone-incoming"
| "phone-off"
| "phone-outgoing"
| "phone"
| "play"
| "plus"
| "refresh-ccw"
| "refresh-cw"
| "repeat"
| "rocket"
| "rotate-ccw"
| "rotate-cw"
| "search"
| "send"
| "settings"
| "share-2"
| "shield-check"
| "shield"
| "shuffle"
| "sliders-horizontal"
| "sliders-vertical"
| "smartphone"
| "sparkles"
| "split"
| "square-check"
| "square-pen"
| "star"
| "sun"
| "sunrise"
| "sunset"
| "tags"
| "terminal"
| "trash-2"
| "trash"
| "trello"
| "triangle-alert"
| "upload"
| "user-check"
| "user-plus"
| "user-x"
| "user"
| "users"
| "venetian-mask"
| "video"
| "waypoints"
| "webhook"
| "x"
| "zap";
| "activity"
| "arrow-down"
| "arrow-left"
| "arrow-right"
| "arrow-up-right"
| "arrow-up"
| "asterisk"
| "at-sign"
| "atom"
| "badge-check"
| "ban"
| "bell"
| "binary"
| "blocks"
| "bold"
| "book-open-check"
| "book-open"
| "book-user"
| "book"
| "bookmark"
| "building"
| "calendar-check-2"
| "calendar-days"
| "calendar-heart"
| "calendar-range"
| "calendar-search"
| "calendar-x-2"
| "calendar"
| "chart-bar"
| "chart-line"
| "check-check"
| "check"
| "chevron-down"
| "chevron-left"
| "chevron-right"
| "chevron-up"
| "chevrons-down-up"
| "chevrons-left"
| "chevrons-right"
| "chevrons-up-down"
| "circle-alert"
| "circle-arrow-up"
| "circle-check-big"
| "circle-check"
| "circle-help"
| "circle-plus"
| "circle-x"
| "circle"
| "clipboard-check"
| "clipboard"
| "clock"
| "code"
| "columns-3"
| "command"
| "contact"
| "copy"
| "corner-down-left"
| "corner-down-right"
| "credit-card"
| "disc"
| "dot"
| "download"
| "ellipsis-vertical"
| "ellipsis"
| "external-link"
| "eye-off"
| "eye"
| "file-down"
| "file-text"
| "file"
| "filter"
| "fingerprint"
| "flag"
| "folder"
| "gift"
| "git-merge"
| "github"
| "globe"
| "grid-3x3"
| "handshake"
| "info"
| "italic"
| "key"
| "layers"
| "layout-dashboard"
| "link-2"
| "link"
| "list-filter"
| "loader"
| "lock-open"
| "lock"
| "log-out"
| "mail-open"
| "mail"
| "map-pin"
| "map"
| "menu"
| "message-circle"
| "messages-square"
| "mic-off"
| "mic"
| "monitor"
| "moon"
| "paintbrush"
| "paperclip"
| "pause"
| "pencil"
| "phone-call"
| "phone-incoming"
| "phone-off"
| "phone-outgoing"
| "phone"
| "play"
| "plus"
| "refresh-ccw"
| "refresh-cw"
| "repeat"
| "rocket"
| "rotate-ccw"
| "rotate-cw"
| "search"
| "send"
| "settings"
| "share-2"
| "shield-check"
| "shield"
| "shuffle"
| "sliders-horizontal"
| "sliders-vertical"
| "smartphone"
| "sparkles"
| "split"
| "square-check"
| "square-pen"
| "star"
| "sun"
| "sunrise"
| "sunset"
| "tags"
| "terminal"
| "trash-2"
| "trash"
| "trello"
| "triangle-alert"
| "upload"
| "user-check"
| "user-plus"
| "user-x"
| "user"
| "users"
| "venetian-mask"
| "video"
| "waypoints"
| "webhook"
| "x"
| "zap";
+4 -4
View File
@@ -61,11 +61,11 @@
},
"license": "MIT",
"scripts": {
"lint": "eslint .",
"lint": "biome lint .",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"lint:fix": "eslint . --fix",
"lint:report": "eslint . --format json --output-file ../../lint-results/ui.json",
"lint:fix": "biome lint --write .",
"lint:report": "biome lint --reporter json . > ../../lint-results/ui.json",
"dx": "node ./scripts/build-icons.mjs",
"dev": "node ./scripts/build-icons.mjs",
"build": "node ./scripts/build-icons.mjs",
@@ -119,8 +119,8 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"devDependencies": {
"@biomejs/biome": "^2.3.8",
"@calcom/config": "workspace:*",
"@calcom/eslint-config": "workspace:*",
"@calcom/tsconfig": "workspace:*",
"@testing-library/user-event": "14.6.1",
"@types/react": "18.0.26",
+5 -1
View File
@@ -5,9 +5,13 @@ import glob from "fast-glob";
import fsExtra from "fs-extra";
import { parse } from "node-html-parser";
import * as path from "node:path";
import { createRequire } from "node:module";
import { copyIcons, removeTempDir } from "./generate-icons.mjs";
const require = createRequire(import.meta.url);
const biomeBin = require.resolve("@biomejs/biome/bin/biome");
const cwd = process.cwd();
const inputDir = path.join(cwd, "svg-icons");
const inputDirRelative = path.relative(cwd, inputDir);
@@ -118,7 +122,7 @@ async function writeIfChanged(filepath, newContent) {
const currentContent = await fsExtra.readFile(filepath, "utf8").catch(() => "");
if (currentContent === newContent) return false;
await fsExtra.writeFile(filepath, newContent, "utf8");
await $`prettier --write ${filepath} --ignore-unknown`;
await $`node ${biomeBin} format --write ${filepath}`;
return true;
}