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

-3
View File
@@ -13,8 +13,5 @@
"connect": "3.7.0",
"http": "0.0.1-security",
"http-proxy-middleware": "2.0.9"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*"
}
}
-5
View File
@@ -1,5 +0,0 @@
.next/
coverage/
node_modules/
tests/
templates/
-3
View File
@@ -1,3 +0,0 @@
import { nextJsConfig } from "@calcom/eslint-config/next-js";
export default nextJsConfig;
+2 -3
View File
@@ -10,15 +10,14 @@
"build": "next build",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
"dev": "PORT=3003 next dev",
"lint": "eslint .",
"lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"start": "PORT=3003 next start",
"docker-start-api": "PORT=80 next start",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@calcom/tsconfig": "workspace:*",
"@calcom/types": "workspace:*",
"node-mocks-http": "1.16.2",
-7
View File
@@ -1,7 +0,0 @@
const rootConfig = require("../../../packages/config/prettier-preset");
module.exports = {
...rootConfig,
importOrder: ["^./instrument", ...rootConfig.importOrder],
importOrderParserPlugins: ["typescript", "decorators-legacy"],
};
+2 -5
View File
@@ -7,7 +7,7 @@
"private": true,
"scripts": {
"build": "yarn dev:build && nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"format": "biome format --write src test",
"start": "nest start",
"dev:build:watch": "concurrently --names \"libraries,lru-fix,constants,enums,utils,types\" \"yarn _dev:build:watch:libraries\" \"yarn _dev:build:watch:libraries:lru-fix\" \"yarn _dev:build:watch:constants\" \"yarn _dev:build:watch:enums\" \"yarn _dev:build:watch:utils\" \"yarn _dev:build:watch:types\"",
"_dev:build:watch:libraries": "yarn workspace @calcom/platform-libraries build:watch",
@@ -86,7 +86,7 @@
"zod": "3.25.76"
},
"devDependencies": {
"@calcom/eslint-config": "workspace:*",
"@biomejs/biome": "^2.3.8",
"@golevelup/ts-jest": "0.4.0",
"@nestjs/cli": "10.3.2",
"@nestjs/schematics": "10.1.1",
@@ -98,14 +98,11 @@
"@types/luxon": "3.4.2",
"@types/passport-jwt": "3.0.13",
"@types/supertest": "2.0.16",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"concurrently": "9.1.2",
"jest": "29.7.0",
"jest-date-mock": "1.0.10",
"jest-junit": "^16.0.0",
"node-mocks-http": "1.16.2",
"prettier": "2.8.7",
"source-map-support": "0.5.21",
"supertest": "6.3.4",
"ts-jest": "29.1.4",
+7 -3
View File
@@ -2,15 +2,19 @@ import { getEnv } from "@/env";
import { Logger } from "@nestjs/common";
import type { NestExpressApplication } from "@nestjs/platform-express";
import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger";
import {
import type {
PathItemObject,
PathsObject,
OperationObject,
} from "@nestjs/swagger/dist/interfaces/open-api-spec.interface";
import "dotenv/config";
import * as fs from "fs";
import { Server } from "http";
import type { Server } from "http";
import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
const nodeRequire = createRequire(__filename);
const biomeBin = nodeRequire.resolve("@biomejs/biome/bin/biome");
const HttpMethods: (keyof PathItemObject)[] = ["get", "post", "put", "delete", "patch", "options", "head"];
@@ -28,7 +32,7 @@ export async function generateSwaggerForApp(app: NestExpressApplication<Server>)
if (fs.existsSync(docsOutputFile) && getEnv("NODE_ENV") === "development") {
fs.unlinkSync(docsOutputFile);
fs.writeFileSync(docsOutputFile, stringifiedContents, { encoding: "utf8" });
spawnSync("npx", ["prettier", docsOutputFile, "--write"], { stdio: "inherit" });
spawnSync("node", [biomeBin, "format", "--write", docsOutputFile], { stdio: "inherit" });
}
if (!process.env.DOCS_URL) {
-1
View File
@@ -1 +0,0 @@
public/embed
-3
View File
@@ -1,3 +0,0 @@
import { nextJsConfig } from "@calcom/eslint-config/next-js";
export default [...nextJsConfig];
+3 -4
View File
@@ -20,9 +20,9 @@
"copy-app-store-static": "node scripts/copy-app-store-static.js",
"build": "next build && yarn sentry:release",
"start": "next start",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:report": "eslint . --format json --output-file ../../lint-results/web.json",
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"lint:report": "biome lint --reporter json . > ../../lint-results/web.json",
"check-changed-files": "ts-node scripts/ts-check-changed-files.ts",
"translate-locales": "ts-node scripts/check-missing-translations.ts",
"stripe:listen": "stripe listen --forward-to http://localhost:3000/api/stripe/webhook"
@@ -152,7 +152,6 @@
"devDependencies": {
"@babel/core": "7.26.10",
"@calcom/config": "workspace:*",
"@calcom/eslint-config": "workspace:*",
"@calcom/types": "workspace:*",
"@microsoft/microsoft-graph-types-beta": "0.15.0-preview",
"@playwright/test": "1.57.0",
+20 -52
View File
@@ -1,6 +1,7 @@
import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";
import { Linter } from "eslint";
import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
import { parse } from "node-html-parser";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
@@ -9,11 +10,8 @@ import { MembershipRole } from "@calcom/prisma/enums";
import { test } from "./lib/fixtures";
const linter = new Linter();
const eslintRules = {
"no-undef": "error",
"no-unused-vars": "off",
} as const;
const nodeRequire = createRequire(__filename);
const biomeBin = nodeRequire.resolve("@biomejs/biome/bin/biome");
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
@@ -431,71 +429,41 @@ async function expectValidHtmlEmbedSnippet(
}
function assertThatCodeIsValidVanillaJsCode(code: string) {
const lintResult = linter.verify(code, [
{
languageOptions: {
ecmaVersion: 2021,
sourceType: "module",
parserOptions: { ecmaFeatures: { jsx: true } },
globals: {
window: "readonly",
document: "readonly",
navigator: "readonly",
Cal: "readonly",
console: "readonly",
},
},
rules: eslintRules,
},
]);
// Use Biome to check if the code is syntactically valid JavaScript
const result = spawnSync("node", [biomeBin, "format", "--stdin-file-path", "snippet.js"], {
input: code,
encoding: "utf-8",
});
if (lintResult.length) {
if (result.status !== 0) {
console.log(
JSON.stringify({
lintResult,
biomeError: result.stderr,
code,
})
);
}
expect(lintResult.length).toBe(0);
expect(result.status).toBe(0);
}
function assertThatCodeIsValidReactCode(code: string) {
const lintResult = linter.verify(code, [
{
languageOptions: {
ecmaVersion: 2021,
sourceType: "module",
parserOptions: {
ecmaFeatures: { jsx: true },
},
globals: {
window: "readonly",
document: "readonly",
navigator: "readonly",
console: "readonly",
},
},
rules: {
...eslintRules,
"@typescript-eslint/no-unused-vars": "off",
"no-undef": "off",
semi: "off",
},
},
]);
// Use Biome to check if the code is syntactically valid JSX
const result = spawnSync("node", [biomeBin, "format", "--stdin-file-path", "snippet.jsx"], {
input: code,
encoding: "utf-8",
});
if (lintResult.length) {
if (result.status !== 0) {
console.log(
JSON.stringify({
lintResult,
biomeError: result.stderr,
code,
})
);
}
expect(lintResult.length).toBe(0);
expect(result.status).toBe(0);
}
async function expectValidReactEmbedSnippet(