:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(tooling): separate oxfmt from oxlint in format scripts (#69709)
Raúl Negrón-Oterobb10f64b43a3
diff --git a/AGENTS.md b/AGENTS.mdindex bcccfd5a99ce..d021754a7970 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -20,7 +20,7 @@- Lint:- Python:- `ruff check . --fix` and `ruff format .`- - Frontend: `pnpm --filter=@posthog/frontend format`+ - Frontend: `pnpm --filter=@posthog/frontend fix` (safe Oxlint fixes + Oxfmt; suggestion fixes are not applied). `format` runs Oxfmt only; `lint` and `format:check` only verify.- TypeScript check: `pnpm --filter=@posthog/frontend typescript:check`- Build:- Frontend: `pnpm --filter=@posthog/frontend build`diff --git a/frontend/package.json b/frontend/package.jsonindex e33152e3d6af..566d735218ca 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -40,7 +40,10 @@"typescript:check": "tsgo --noEmit && echo \"No errors reported by tsgo.\"","typescript:version": "tsgo --version","lint": "cd .. && oxlint --quiet",- "format": "cd .. && oxlint --fix --fix-suggestions --fix-dangerously --quiet && oxfmt \"./{products,frontend/src,docs}/**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "lint:fix": "cd .. && oxlint --fix --quiet",+ "format": "cd .. && oxfmt \"./{products,frontend/src,docs}/**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "format:check": "cd .. && oxfmt --check \"./{products,frontend/src,docs}/**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "fix": "pnpm lint:fix; s=$?; pnpm format && exit $s","visualize-toolbar-bundle": "pnpm exec esbuild-visualizer --metadata ./toolbar-esbuild-meta.json --filename=toolbar-esbuild-bundle-visualization.html","check-toolbar-csp-eval": "node ./bin/check-toolbar-csp-eval.mjs","check-toolbar-graph": "node ./bin/check-toolbar-graph.mjs",diff --git a/frontend/src/AGENTS.md b/frontend/src/AGENTS.mdindex 5e9e0e834c73..6fa9bf65101f 100644--- a/frontend/src/AGENTS.md+++ b/frontend/src/AGENTS.md@@ -55,7 +55,7 @@ These are slow; run them at the right moment, not after every edit.## Lint & format-Run `pnpm --filter=@posthog/frontend format` (oxlint `--fix` + oxfmt) before finishing. Config: root `.oxlintrc.json`. CSS, spelling, and copy-casing rules live in the root `AGENTS.md` (Code Style).+Run `pnpm --filter=@posthog/frontend fix` before finishing. It applies safe Oxlint fixes, never suggestion fixes, and always runs Oxfmt; it fails if either tool fails. `format` runs Oxfmt only, while `lint` and `format:check` only verify. Config: root `.oxlintrc.json`. CSS, spelling, and copy-casing rules live in the root `AGENTS.md` (Code Style).## Adding actions to a scenediff --git a/services/agent-proxy/package.json b/services/agent-proxy/package.jsonindex b4120dcfebed..7020e0413862 100644--- a/services/agent-proxy/package.json+++ b/services/agent-proxy/package.json@@ -10,7 +10,11 @@"dev": "tsx scripts/dev-agent-proxy.ts | pino-pretty --colorize --ignore pid,hostname --messageKey event --translateTime SYS:HH:MM:ss.l","test": "vitest","typecheck": "tsc --noEmit",- "format": "oxlint --fix --fix-suggestions --fix-dangerously --quiet && oxfmt \"./**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\""+ "lint": "oxlint --quiet",+ "lint:fix": "oxlint --fix --quiet",+ "format": "oxfmt \"./**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "format:check": "oxfmt --check \"./**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "fix": "pnpm lint:fix; s=$?; pnpm format && exit $s"},"dependencies": {"@hono/node-server": "^2.0.2",diff --git a/services/mcp/AGENTS.md b/services/mcp/AGENTS.mdindex 14a5aca84a04..d43df609dcde 100644--- a/services/mcp/AGENTS.md+++ b/services/mcp/AGENTS.md@@ -5,4 +5,6 @@Run these commands from the repository root:- Run `pnpm --filter=@posthog/mcp run typecheck` after changing TypeScript or TSX files. It checks types without emitting files.-- Run `pnpm --filter=@posthog/mcp run format` before committing JavaScript, TypeScript, JSON, YAML, CSS, or SCSS changes. It applies Oxlint fixes and Oxfmt formatting, so it may rewrite files.+- Run `pnpm --filter=@posthog/mcp run format` to apply Oxfmt only. Use `lint` and `format:check` for verification; neither command rewrites files.+- Run `pnpm --filter=@posthog/mcp run lint:fix` to apply safe Oxlint fixes. It does not apply suggestion fixes that may change behavior.+- Run `pnpm --filter=@posthog/mcp run fix` before committing JavaScript, TypeScript, JSON, YAML, CSS, or SCSS changes. It applies safe Oxlint fixes, always runs Oxfmt, and fails if either tool fails.diff --git a/services/mcp/README.md b/services/mcp/README.mdindex fe8653cb5727..729bee67e18b 100644--- a/services/mcp/README.md+++ b/services/mcp/README.md@@ -356,7 +356,10 @@ This repository is organized to support multiple language implementations:- `pnpm run dev` - Start the MCP development server- `pnpm run dev:proxy` - Start the edge-proxy worker (wrangler)-- `pnpm run format` - Format and lint code+- `pnpm run lint` / `pnpm run format:check` - Verify linting and formatting without changing files+- `pnpm run lint:fix` - Apply safe lint fixes without suggestion fixes+- `pnpm run format` - Format code with Oxfmt only+- `pnpm run fix` - Apply safe lint fixes, always format code, and report failures from either tool### Adding New Toolsdiff --git a/services/mcp/package.json b/services/mcp/package.jsonindex 8dd1274b4d89..a7ec62fe00dc 100644--- a/services/mcp/package.json+++ b/services/mcp/package.json@@ -39,7 +39,11 @@"generate-cli-agent-scopes": "tsx scripts/build-cli-agent-scopes.ts","scaffold-yaml": "tsx scripts/scaffold-yaml.ts","lint-tool-names": "tsx scripts/lint-tool-names.ts",- "format": "oxlint --fix --fix-suggestions --fix-dangerously --quiet && oxfmt \"./**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\""+ "lint": "oxlint --quiet",+ "lint:fix": "oxlint --fix --quiet",+ "format": "oxfmt \"./**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "format:check": "oxfmt --check \"./**/*.{js,mjs,ts,tsx,json,yaml,yml,css,scss}\"",+ "fix": "pnpm lint:fix; s=$?; pnpm format && exit $s"},"dependencies": {"@hono/node-server": "^2.0.2",diff --git a/services/mcp/tests/hono/dispatcher-profile.perf.ts b/services/mcp/tests/hono/dispatcher-profile.perf.tsindex 4c018500ddbc..bb7799fcc3b0 100644--- a/services/mcp/tests/hono/dispatcher-profile.perf.ts+++ b/services/mcp/tests/hono/dispatcher-profile.perf.ts@@ -23,9 +23,9 @@ vi.mock('@/resources', () => ({getPromptsFromManifest: vi.fn().mockResolvedValue([]),}))-import type { RequestProperties } from '@/lib/request-properties'import { McpDispatcher } from '@/hono/dispatcher'import { ToolCatalog } from '@/hono/tool-catalog'+import type { RequestProperties } from '@/lib/request-properties'class MockRedis {private store = new Map<string, string>()