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