Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,7 @@ See the [Migrate from v1.x to v2.x guide](https://www.braintrust.dev/docs/refere
### Upgrading from 0.x to 1.x

See the [Migrate from v1.x to v2.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v0-to-v1).

## Compatibility

The `braintrust` package is compatible with Node.js versions 20.12.0, 22.13.0, for the respective major Node.js release lines and above.
22 changes: 22 additions & 0 deletions js/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import esX from "eslint-plugin-es-x";
import n from "eslint-plugin-n";
import nodeImport from "eslint-plugin-node-import";
import tsupConfigImport from "./tsup.config";

const supportedNodeVersionRange = "^20.12.0 || ^21.7.0 || ^22.13.0 || >=23.5.0";

// Handle both ESM and CJS module formats
const tsupConfig = Array.isArray(tsupConfigImport)
? tsupConfigImport
Expand Down Expand Up @@ -51,11 +55,14 @@ export default [
},
plugins: {
"@typescript-eslint": tseslint,
"es-x": esX,
n,
"node-import": nodeImport,
},
rules: {
// Base TypeScript rules
...tseslint.configs.recommended.rules,
...esX.configs["flat/restrict-to-es2022"].rules,
// TODO: Fix violations and re-enable as "error"
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
Expand Down Expand Up @@ -130,6 +137,21 @@ export default [
"AsyncLocalStorage.enterWith() is not supported in Cloudflare Workers. Use AsyncLocalStorage.run() to scope context instead.",
},
],
"n/no-unsupported-features/node-builtins": [
"error",
{
version: supportedNodeVersionRange,
allowExperimental: true,
},
],
"n/no-unsupported-features/es-builtins": [
"error",
{ version: supportedNodeVersionRange },
],
"n/no-unsupported-features/es-syntax": [
"error",
{ version: supportedNodeVersionRange },
],
// Require node: protocol for Node.js built-in imports (for Deno compatibility)
// This plugin automatically detects ALL Node.js built-ins - no manual list needed!
"node-import/prefer-node-protocol": "error",
Expand Down
3 changes: 3 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,14 @@
"ai": "^6.0.0",
"async": "^3.2.5",
"cross-env": "^7.0.3",
"eslint-plugin-es-x": "9.7.0",
"eslint-plugin-n": "^18.2.1",
"eslint-plugin-node-import": "^1.0.5",
"openai": "6.25.0",
"rollup": "^4.60.3",
"tar": "^7.5.16",
"tinybench": "^4.0.1",
"ts-declaration-location": "^1.0.7",
"tsup": "^8.5.1",
"tsx": "^4.21.0",
"typedoc": "^0.25.13",
Expand Down
101 changes: 101 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading