mirror of
https://github.com/ComposioHQ/composio.git
synced 2026-09-22 11:46:35 +08:00
f233e46937
This PR: - replaces ESLint with oxlint across the pnpm workspace and the Bun-based docs site, porting the rules to `.oxlintrc.json` / `docs/.oxlintrc.json` with behavior parity (restricted-syntax selectors kept via `oxlint-plugin-eslint`) - migrates typecheck to TypeScript 7 (`typescript@^7.0.2` catalog) and keeps a TS6 pin for JS compiler API consumers via a named `ts6` pnpm catalog (`ts/scripts/validate-examples.ts`, the `@composio/cli` generate pipeline). The CLI's `typescript` dependency rebinds only the compiler-API import — its typecheck still runs the root TS7 `tsc`, since the alias package only ships a `tsc6` bin (documented in `ts/packages/cli/AGENTS.md`) - removes the `paths` mappings that pointed `@composio/core` (and, in `experimental`, `@composio/json-schema-to-zod` plus core-internal `#`-imports) at sibling `src` directories: under TS7, tsdown's tsgo-based dts step emitted stray `.d.ts` files next to those out-of-root sources on every dependent package build. Workspace deps now resolve through their built dist types, which turbo's `dependsOn: ^build` already guarantees exist — and which the deep-path exports (`@composio/core/*`) always used anyway - renames the cli boundary tooling `eslint-boundaries*` → `lint-boundaries*` and hardens the scanner to reject `oxlint-disable` spellings so the disable manifest cannot be bypassed - rewrites inline `eslint-disable` comments to oxlint rule names (comment-only; no runtime changes), and adds **one new** declared boundary: `tool-file-uploads.ts` needs `no-restricted-imports` disabled for `node:crypto` (MD5 for the presigned-upload checksum is not in Web Crypto), because oxlint also catches dynamic `await import()` where ESLint did not. The manifest grows 46 → 47 deliberately - updates CI path filters, `turbo.jsonc` lint inputs, and the docs typescript-check workflow (renamed to "Docs - Lint and TypeScript Validation" since it now lints too); drops `eslint`, `typescript-eslint`, `eslint-config-next`, and `globals` from the dependency graphs - ships no changeset: I built `@composio/core` and `@composio/anthropic` on this branch and on the pre-migration base and diffed the emitted `dist/**/*.d.mts`. The provider output is byte-identical. Core's output is **semantically identical but not byte-identical**: TS7 changes quote style (`"x"` → `'x'`), object-property and union-member ordering in inferred types, and picks equivalent shorter re-export alias paths for five signatures (e.g. `OpenAI.Beta.Threads.Runs.Run` → `OpenAI.Beta.Threads.Run` — verified both names alias the same type in the shipped typings). Chunk-name hashes shift as a consequence. No type gains, losses, or shape changes; `attw` and `publint` pass on the TS7 build ## Context First of a three-PR split of #3958. The type-safety refactors are stacked on this branch and merge after it: - docs: https://github.com/ComposioHQ/composio/pull/3967 - `@composio/core`: https://github.com/ComposioHQ/composio/pull/3968
416 lines
18 KiB
JSON
416 lines
18 KiB
JSON
{
|
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
// Ported from eslint.config.mjs (see git history). Native oxlint rules cover
|
|
// everything except no-restricted-syntax, which runs through the
|
|
// oxlint-plugin-eslint JS plugin as eslint-js/no-restricted-syntax.
|
|
"plugins": ["typescript", "unicorn", "oxc"],
|
|
"jsPlugins": [{ "name": "eslint-js", "specifier": "oxlint-plugin-eslint" }],
|
|
"categories": {
|
|
"correctness": "error"
|
|
},
|
|
"env": {
|
|
"browser": true
|
|
},
|
|
"ignorePatterns": [
|
|
"**/.venv/**",
|
|
"**/.next/**",
|
|
"**/dist/**",
|
|
"**/site-packages/**",
|
|
"**/__fixtures__/**",
|
|
"**/fixtures/**",
|
|
// New exclusion vs eslint.config.mjs: mock modules are test scaffolding,
|
|
// same as fixtures; the CI gate (pnpm lint → ts/packages) never reached them.
|
|
"**/__mocks__/**",
|
|
// The docs site has its own Bun dependency tree and nested oxlint config.
|
|
"docs/**",
|
|
"ts/vendor/**",
|
|
"ts/packages/cli-local-tools/vendor/**",
|
|
"ts/packages/**/.generated/**",
|
|
"ts/packages/**/acp-adapters/**",
|
|
"node_modules/**",
|
|
"ts/examples/**/dist-worker/**",
|
|
"scripts/**",
|
|
"test/**",
|
|
"ts/packages/*/test/**",
|
|
"ts/packages/providers/*/test/**",
|
|
"!ts/packages/cli/test/**",
|
|
"ts/packages/cli/test/__utils__/**",
|
|
// New exclusions vs eslint.config.mjs: the CI gate (pnpm lint) only ever
|
|
// targeted ts/packages, so e2e suites and repo scripts were lint:fix-only
|
|
// surface. Excluded explicitly now that oxlint also runs from the repo root.
|
|
"ts/e2e-tests/**",
|
|
"ts/scripts/**",
|
|
// ESLint only linted .ts/.tsx (--ext .ts,.tsx); keep that scope.
|
|
"**/*.js",
|
|
"**/*.mjs",
|
|
"**/*.cjs",
|
|
"**/*.jsx",
|
|
// New exclusion vs eslint.config.mjs (which matched .d.ts via --ext .ts):
|
|
// ambient declarations are type-only surface covered by typecheck.
|
|
"**/*.d.ts"
|
|
],
|
|
"rules": {
|
|
// Rules oxlint enables by default that the previous ESLint setup did not
|
|
// enforce. Turned off to keep the migration behavior-preserving; each is a
|
|
// candidate to enable (and burn down) in a follow-up.
|
|
"no-useless-escape": "off",
|
|
"no-control-regex": "off",
|
|
"no-useless-catch": "off",
|
|
"typescript/no-unnecessary-parameter-property-assignment": "off",
|
|
"unicorn/no-useless-spread": "off",
|
|
"unicorn/no-useless-fallback-in-spread": "off",
|
|
"unicorn/no-thenable": "off",
|
|
"unicorn/no-empty-file": "off",
|
|
"no-restricted-globals": ["error", "Buffer"],
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": [
|
|
{ "name": "crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "node:crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "node:buffer", "message": "Use Uint8Array instead." }
|
|
]
|
|
}
|
|
],
|
|
"typescript/no-require-imports": "warn",
|
|
"typescript/no-unsafe-function-type": "off",
|
|
"no-prototype-builtins": "off",
|
|
"max-lines-per-function": ["error", 250],
|
|
"typescript/ban-ts-comment": "warn",
|
|
"no-constant-condition": "off",
|
|
"no-ex-assign": "off",
|
|
"no-constant-binary-expression": "off",
|
|
"typescript/no-empty-object-type": "warn",
|
|
"typescript/no-non-null-asserted-optional-chain": "off",
|
|
"no-unsafe-optional-chaining": "off",
|
|
"no-extra-boolean-cast": "off",
|
|
"no-var": "warn",
|
|
"prefer-const": "warn",
|
|
"no-console": "warn",
|
|
"typescript/no-explicit-any": "error",
|
|
"no-unused-vars": [
|
|
"warn",
|
|
{
|
|
"argsIgnorePattern": "^_",
|
|
"varsIgnorePattern": "^_",
|
|
"caughtErrorsIgnorePattern": "^_"
|
|
}
|
|
]
|
|
},
|
|
"overrides": [
|
|
{
|
|
"files": ["ts/packages/cli/src/**/*.{ts,tsx}"],
|
|
"rules": {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": [
|
|
{ "name": "crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "node:crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "node:buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "child_process", "message": "Use Command from @effect/platform instead." },
|
|
{
|
|
"name": "node:child_process",
|
|
"message": "Use Command from @effect/platform instead."
|
|
},
|
|
{ "name": "fs", "message": "Use FileSystem from @effect/platform instead." },
|
|
{ "name": "node:fs", "message": "Use FileSystem from @effect/platform instead." },
|
|
{
|
|
"name": "os",
|
|
"message": "Use an Effect service instead of importing node:os directly."
|
|
},
|
|
{
|
|
"name": "node:os",
|
|
"message": "Use an Effect service instead of importing node:os directly."
|
|
},
|
|
{ "name": "path", "message": "Use Path from @effect/platform instead." },
|
|
{ "name": "node:path", "message": "Use Path from @effect/platform instead." },
|
|
{
|
|
"name": "@effect/cli",
|
|
"importNames": ["CommandDescriptor", "Usage"],
|
|
"message": "CommandDescriptor/Usage introspection is the @effect/cli v4 seam. Use the helpers in ts/packages/cli/src/commands/command-introspection.ts instead."
|
|
}
|
|
],
|
|
"patterns": [
|
|
{
|
|
"group": ["fs/*", "node:fs/*"],
|
|
"message": "Use FileSystem from @effect/platform instead."
|
|
},
|
|
{
|
|
"group": ["@effect/cli/CommandDescriptor", "@effect/cli/Usage"],
|
|
"message": "CommandDescriptor/Usage introspection is the @effect/cli v4 seam. Use the helpers in ts/packages/cli/src/commands/command-introspection.ts instead."
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"eslint-js/no-restricted-syntax": [
|
|
"error",
|
|
{
|
|
"selector": "TryStatement",
|
|
"message": "Use Effect.try, Effect.tryPromise, or typed Effect error recovery instead of try/catch."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][computed=false][property.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][computed=true][property.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "VariableDeclarator[init.name='process'] > ObjectPattern > Property[key.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "VariableDeclarator[init.name='process'] > ObjectPattern > Property[key.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentExpression[right.name='process'] > ObjectPattern > Property[key.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentExpression[right.name='process'] > ObjectPattern > Property[key.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentPattern[right.name='process'] > ObjectPattern > Property[key.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentPattern[right.name='process'] > ObjectPattern > Property[key.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][property.name='stdout']",
|
|
"message": "Write output and read terminal capabilities through TerminalUI."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][property.name='stderr']",
|
|
"message": "Write errors and read terminal capabilities through TerminalUI."
|
|
},
|
|
{
|
|
"selector": "ImportExpression[source.value=/^@effect\\/cli(?:\\/(?:CommandDescriptor|Usage))?$/]",
|
|
"message": "CommandDescriptor/Usage introspection is the @effect/cli v4 seam. Use the helpers in ts/packages/cli/src/commands/command-introspection.ts instead."
|
|
},
|
|
{
|
|
"selector": "CallExpression[callee.name='require'][arguments.0.value=/^@effect\\/cli(?:\\/(?:CommandDescriptor|Usage))?$/]",
|
|
"message": "CommandDescriptor/Usage introspection is the @effect/cli v4 seam. Use the helpers in ts/packages/cli/src/commands/command-introspection.ts instead."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": ["ts/packages/cli/test/src/**/*.{ts,tsx}"],
|
|
"rules": {
|
|
"max-lines-per-function": "off",
|
|
"typescript/no-explicit-any": "off",
|
|
"eslint-js/no-restricted-syntax": [
|
|
"error",
|
|
{
|
|
"selector": "MemberExpression[object.name='Effect'][property.name=/^run/]",
|
|
"message": "Run Effects through @effect/vitest (it.effect, it.scoped, it.live) instead of Effect.run* in tests."
|
|
},
|
|
{
|
|
"selector": "CallExpression[callee.object.name='Date'][callee.property.name='now']",
|
|
"message": "Tests must be deterministic: pin time with vi.setSystemTime / TestClock-relative fixtures, use crypto.randomUUID() for unique names."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": ["ts/packages/cli/src/commands/command-introspection.ts"],
|
|
"rules": {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": [
|
|
{ "name": "crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "node:crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "node:buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "child_process", "message": "Use Command from @effect/platform instead." },
|
|
{
|
|
"name": "node:child_process",
|
|
"message": "Use Command from @effect/platform instead."
|
|
},
|
|
{ "name": "fs", "message": "Use FileSystem from @effect/platform instead." },
|
|
{ "name": "node:fs", "message": "Use FileSystem from @effect/platform instead." },
|
|
{
|
|
"name": "os",
|
|
"message": "Use an Effect service instead of importing node:os directly."
|
|
},
|
|
{
|
|
"name": "node:os",
|
|
"message": "Use an Effect service instead of importing node:os directly."
|
|
},
|
|
{ "name": "path", "message": "Use Path from @effect/platform instead." },
|
|
{ "name": "node:path", "message": "Use Path from @effect/platform instead." }
|
|
],
|
|
"patterns": [
|
|
{
|
|
"group": ["fs/*", "node:fs/*"],
|
|
"message": "Use FileSystem from @effect/platform instead."
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"eslint-js/no-restricted-syntax": [
|
|
"error",
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][property.name='stdout']",
|
|
"message": "Write output and read terminal capabilities through TerminalUI."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][property.name='stderr']",
|
|
"message": "Write errors and read terminal capabilities through TerminalUI."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": ["ts/packages/cli/src/services/tool-input-validation.ts"],
|
|
"rules": {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": [
|
|
{ "name": "crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "node:crypto", "message": "Use Web Crypto API instead." },
|
|
{ "name": "buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "node:buffer", "message": "Use Uint8Array instead." },
|
|
{ "name": "child_process", "message": "Use Command from @effect/platform instead." },
|
|
{
|
|
"name": "node:child_process",
|
|
"message": "Use Command from @effect/platform instead."
|
|
},
|
|
{ "name": "fs", "message": "Use FileSystem from @effect/platform instead." },
|
|
{ "name": "node:fs", "message": "Use FileSystem from @effect/platform instead." },
|
|
{
|
|
"name": "os",
|
|
"message": "Use an Effect service instead of importing node:os directly."
|
|
},
|
|
{
|
|
"name": "node:os",
|
|
"message": "Use an Effect service instead of importing node:os directly."
|
|
},
|
|
{ "name": "path", "message": "Use Path from @effect/platform instead." },
|
|
{ "name": "node:path", "message": "Use Path from @effect/platform instead." },
|
|
{ "name": "zod", "message": "Use Schema from effect for tool input validation." }
|
|
],
|
|
"patterns": [
|
|
{
|
|
"group": ["fs/*", "node:fs/*"],
|
|
"message": "Use FileSystem from @effect/platform instead."
|
|
},
|
|
{ "group": ["zod/*"], "message": "Use Schema from effect for tool input validation." }
|
|
]
|
|
}
|
|
],
|
|
"eslint-js/no-restricted-syntax": [
|
|
"error",
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][property.name='stdout']",
|
|
"message": "Write output and read terminal capabilities through TerminalUI."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][property.name='stderr']",
|
|
"message": "Write errors and read terminal capabilities through TerminalUI."
|
|
},
|
|
{
|
|
"selector": "ImportExpression[source.value=/^@effect\\/cli(?:\\/(?:CommandDescriptor|Usage))?$/]",
|
|
"message": "CommandDescriptor/Usage introspection is the @effect/cli v4 seam. Use the helpers in ts/packages/cli/src/commands/command-introspection.ts instead."
|
|
},
|
|
{
|
|
"selector": "CallExpression[callee.name='require'][arguments.0.value=/^@effect\\/cli(?:\\/(?:CommandDescriptor|Usage))?$/]",
|
|
"message": "CommandDescriptor/Usage introspection is the @effect/cli v4 seam. Use the helpers in ts/packages/cli/src/commands/command-introspection.ts instead."
|
|
},
|
|
{
|
|
"selector": "ImportExpression[source.value=/^zod(?:\\/|$)/]",
|
|
"message": "Use Schema from effect for tool input validation."
|
|
},
|
|
{
|
|
"selector": "CallExpression[callee.name='require'][arguments.0.value=/^zod(?:\\/|$)/]",
|
|
"message": "Use Schema from effect for tool input validation."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": ["ts/packages/cli/src/services/terminal-ui.ts"],
|
|
"rules": {
|
|
// TerminalUI is the sole CLI boundary for Node's stdout and stderr streams.
|
|
"eslint-js/no-restricted-syntax": [
|
|
"error",
|
|
{
|
|
"selector": "TryStatement",
|
|
"message": "Use Effect.try, Effect.tryPromise, or typed Effect error recovery instead of try/catch."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][computed=false][property.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "MemberExpression[object.name='process'][computed=true][property.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "VariableDeclarator[init.name='process'] > ObjectPattern > Property[key.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "VariableDeclarator[init.name='process'] > ObjectPattern > Property[key.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentExpression[right.name='process'] > ObjectPattern > Property[key.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentExpression[right.name='process'] > ObjectPattern > Property[key.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentPattern[right.name='process'] > ObjectPattern > Property[key.name='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
},
|
|
{
|
|
"selector": "AssignmentPattern[right.name='process'] > ObjectPattern > Property[key.value='env']",
|
|
"message": "Read environment variables through effect/Config instead of process.env."
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
// Examples are console-driven references. Keep type-safety rules
|
|
// (no-explicit-any, unused-vars) but drop console noise. The Buffer/crypto
|
|
// restrictions above target SDK/Workers source; Node example scripts may
|
|
// legitimately use Node built-ins, so relax them here (see KTD6).
|
|
"files": ["ts/examples/**/*.ts"],
|
|
"rules": {
|
|
"no-console": "off",
|
|
"no-restricted-globals": "off",
|
|
"no-restricted-imports": "off"
|
|
}
|
|
},
|
|
{
|
|
// This factory intentionally assembles the complete pi session-tool surface
|
|
// in one closure so every hook shares the same normalized capabilities.
|
|
"files": ["ts/packages/experimental/src/pi/session-tools.ts"],
|
|
"rules": {
|
|
"max-lines-per-function": "off"
|
|
}
|
|
},
|
|
{
|
|
// The Cloudflare Workers entry stays portable: no Node globals even though
|
|
// nodejs_compat is enabled. Re-apply the restriction dropped just above.
|
|
"files": ["ts/examples/**/cloudflare.ts"],
|
|
"rules": {
|
|
"no-restricted-globals": ["error", "Buffer"]
|
|
}
|
|
}
|
|
]
|
|
}
|