From 8005e52e30ffbad12dd09c4e4f96a0b3b73c6126 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Tue, 24 Feb 2026 11:57:57 +0000 Subject: [PATCH] Migrate formatting/linting to Oxfmt & Oxlint Replace Prettier/Biome with Oxfmt and Oxlint across the repo. Added .oxfmtrc.json and .oxlintrc.json, removed .prettierrc and biome.json, and updated AGENTS.md to document the new formatter/linter and configurations. Updated inline lint pragmas in source/fixture files (e.g. biome-ignore -> oxlint-disable-next-line or jsx-a11y/media-has-caption) and adjusted package.json dev dependencies to use oxfmt/oxlint. Miscellaneous code/test script changes to align with the new tooling. --- .oxfmtrc.json | 6 + .oxlintrc.json | 34 + .prettierrc | 1 - AGENTS.md | 30 +- biome.json | 62 - fixtures/partytracks/src/client.tsx | 4 +- fixtures/video-echo/src/Demo.tsx | 2 +- package-lock.json | 1153 ++++++++++++----- package.json | 12 +- packages/hono-party/scripts/build.ts | 4 +- packages/partyfn/scripts/build.ts | 4 +- packages/partyserver/scripts/build.ts | 4 +- packages/partyserver/src/connection.ts | 3 - packages/partyserver/src/index.ts | 20 +- packages/partyserver/src/tests/wrangler.jsonc | 2 +- packages/partysocket/scripts/build.ts | 10 +- packages/partysocket/src/index.ts | 2 +- .../src/tests/react-hooks.test.tsx | 2 +- .../src/tests/reconnecting-node.test.ts | 4 +- .../src/tests/reconnecting.test.ts | 2 +- packages/partysocket/src/use-socket.ts | 3 +- packages/partysocket/src/ws.ts | 10 +- packages/partysub/scripts/build.ts | 4 +- packages/partysync/scripts/build.ts | 4 +- packages/partysync/src/server/index.ts | 4 +- packages/partytracks/package.json | 2 +- .../partytracks/src/client/PartyTracks.ts | 2 +- packages/partytracks/src/client/getDevices.ts | 2 +- packages/partytracks/src/react/rxjsHooks.ts | 1 + packages/partywhen/scripts/build.ts | 4 +- packages/partywhen/tests/index.test.ts | 8 +- packages/y-partyserver/scripts/build.ts | 4 +- packages/y-partyserver/src/server/index.ts | 10 +- scripts/check-exports.ts | 2 +- 34 files changed, 961 insertions(+), 460 deletions(-) create mode 100644 .oxfmtrc.json create mode 100644 .oxlintrc.json delete mode 100644 .prettierrc delete mode 100644 biome.json diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 00000000..a18f73a6 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "trailingComma": "none", + "printWidth": 80, + "experimentalSortPackageJson": false +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 00000000..ae68b2b1 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,34 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["react", "jsx-a11y", "typescript", "react-hooks"], + "categories": { + "correctness": "error" + }, + "rules": { + "no-explicit-any": "off", + "no-unused-expressions": "off", + "no-this-alias": "off", + "no-non-null-assertion": "off", + "no-redeclare": "off", + "react-hooks/exhaustive-deps": "warn", + "jsx-a11y/no-autofocus": "off", + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ] + }, + "ignorePatterns": [ + "**/dist", + "**/coverage", + "**/*.d.ts", + "**/*.d.mts", + "**/*.d.cts", + "**/env.d.ts", + "**/.wrangler", + "**/node_modules" + ] +} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 19c984fd..00000000 --- a/.prettierrc +++ /dev/null @@ -1 +0,0 @@ -{ "singleQuote": false, "trailingComma": "none" } diff --git a/AGENTS.md b/AGENTS.md index b611a6a3..a6783193 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,9 +22,9 @@ PartyServer is a **monorepo** using npm workspaces with multiple packages: ```bash npm run build # Build all packages npm run check # Run all checks (format, lint, type, test) -npm run format # Format code with Prettier -npm run check:format # Check code formatting -npm run check:lint # Run Biome linter +npm run format # Format code with Oxfmt +npm run check:format # Check code formatting with Oxfmt +npm run check:lint # Run Oxlint linter npm run check:type # Type-check all packages npm run check:test # Run all tests npm run check:repo # Run sherif (monorepo consistency) @@ -57,20 +57,22 @@ npx vitest reconnecting ### Formatting -- **Formatter**: Prettier (NOT Biome formatter - it's disabled) +- **Formatter**: Oxfmt (configured in `.oxfmtrc.json`) - **Quote style**: Double quotes (`"`) - **Trailing commas**: None -- **Line length**: Default Prettier settings +- **Print width**: 80 - Run `npm run format` before committing ### Linting -- **Linter**: Biome (configured in `biome.json`) -- Recommended rules enabled with specific overrides: - - `noNonNullAssertion`: off (non-null assertions allowed) - - `noParameterAssign`: off (parameter reassignment allowed) - - `noForEach`: off (forEach allowed) - - `noRedeclare`: off +- **Linter**: Oxlint (configured in `.oxlintrc.json`) +- Plugins: `react`, `jsx-a11y`, `typescript`, `react-hooks` +- Key rules: + - `no-explicit-any`: off + - `no-non-null-assertion`: off + - `no-redeclare`: off + - `no-unused-vars`: error (with `^_` ignore patterns for args/vars/caught) + - `react-hooks/exhaustive-deps`: warn - Run `npm run check:lint` to verify ### TypeScript @@ -139,9 +141,9 @@ function assert(condition: unknown, msg?: string): asserts condition { - Use `// TODO:` for action items - Use JSDoc for public API documentation - Prefer descriptive names over comments -- Use `biome-ignore` or `@ts-expect-error` with explanations when necessary: +- Use `oxlint-disable-next-line` or `@ts-expect-error` with explanations when necessary: ```typescript - // biome-ignore lint/suspicious/noExplicitAny: legacy code + // oxlint-disable-next-line no-explicit-any // @ts-expect-error ws types are weird ``` @@ -173,7 +175,7 @@ function assert(condition: unknown, msg?: string): asserts condition { - Dual format: ESM and CommonJS - Generate both `.d.ts` and `.d.cts` declaration files -- Run prettier on generated output files (handled by build scripts) +- Run oxfmt on generated output files (handled by build scripts) - Use `tsdown` for building packages - Verify exports with `scripts/check-exports.ts` diff --git a/biome.json b/biome.json deleted file mode 100644 index c294f14c..00000000 --- a/biome.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/2.4.4/schema.json", - "vcs": { - "enabled": false, - "clientKind": "git", - "useIgnoreFile": false - }, - "assist": { - "actions": { - "source": { - "useSortedKeys": "off", - "organizeImports": "off" - } - }, - "enabled": true - }, - "files": { - "ignoreUnknown": false, - "includes": [ - "fixtures/**", - "packages/**", - "!**/node_modules", - "!**/dist", - "!**/coverage", - "!**/*.d.ts", - "!**/*.d.mts", - "!**/*.d.cts", - "!packages/partysocket/event-target-polyfill.*", - "!tsconfig.base.json", - "!**/.wrangler", - "!**/lexical.css", - "!**/normalize.css", - "!**/reset.css" - ] - }, - "formatter": { - "enabled": false - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "style": { - "noNonNullAssertion": "off", - "noParameterAssign": "off", - "noUselessElse": "off" - }, - "suspicious": { - "noRedeclare": "off", - "noConfusingVoidType": "off" - }, - "complexity": { - "noForEach": "off" - } - } - }, - "javascript": { - "formatter": { - "quoteStyle": "double" - } - } -} diff --git a/fixtures/partytracks/src/client.tsx b/fixtures/partytracks/src/client.tsx index fc6d50ab..36e3e75f 100644 --- a/fixtures/partytracks/src/client.tsx +++ b/fixtures/partytracks/src/client.tsx @@ -242,9 +242,9 @@ pulledScreenshareVideoTrack$.subscribe((track) => { }); const audioSink = createAudioSink({ audioElement: audio }); -// biome-ignore lint/correctness/noUnusedVariables: it's fine +// oxlint-disable-next-line no-unused-vars const pulledTrackSinkSubscription = audioSink.attach(pulledAudioTrack$); -// biome-ignore lint/correctness/noUnusedVariables: it's fine +// oxlint-disable-next-line no-unused-vars const pulledScreenshareAudioTrackSinkSubscription = audioSink.attach( pulledScreenshareAudioTrack$ ); diff --git a/fixtures/video-echo/src/Demo.tsx b/fixtures/video-echo/src/Demo.tsx index 25f7515d..dfca33d1 100644 --- a/fixtures/video-echo/src/Demo.tsx +++ b/fixtures/video-echo/src/Demo.tsx @@ -120,7 +120,7 @@ function Audio(props: { audioTrack$: Observable }) { } }); - // biome-ignore lint/a11y/useMediaCaption: Not able to generate captions for this currently. + // oxlint-disable-next-line jsx-a11y/media-has-caption return