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

+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(