The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
build(pre-commit): regenerate eslint-metrics.json instead of failing on drift (#32717)
ryan-crabbe-berri270406b8ad5f
diff --git a/scripts/pre_commit_lint.sh b/scripts/pre_commit_lint.shindex 04a2af56ce2..bd416ab814d 100755--- a/scripts/pre_commit_lint.sh+++ b/scripts/pre_commit_lint.sh@@ -76,11 +76,18 @@ EOFfi# Whole-folder lint budgets, exactly as the frontend-lint job runs them: the# counts and the committed metrics file are not diff-scoped, so a local pass- # here means the budget step will pass in CI too.+ # here means the budget step will pass in CI too. Unlike CI (which --checks and+ # fails), regenerate eslint-metrics.json from the same report — same as the+ # gen:api block below regenerates schema.d.ts — then flag drift so you re-stage+ # it, instead of making you run npm run lint:metrics by hand.report=$(mktemp)npx eslint . -f json -o "$report" || true- node scripts/check-lint-budgets.mjs "$report" eslint-budgets.json --check eslint-metrics.json || rc=1+ node scripts/check-lint-budgets.mjs "$report" eslint-budgets.json --write eslint-metrics.json || rc=1rm -f "$report"+ if ! git diff --quiet -- eslint-metrics.json; then+ echo "✗ eslint-metrics.json was stale; regenerated it. Stage it and re-run make pre-commit." >&2+ rc=1+ fiexit $rc)}diff --git a/ui/litellm-dashboard/eslint-metrics.json b/ui/litellm-dashboard/eslint-metrics.jsonindex c6d4bfc9ac8..8e1f4de5872 100644--- a/ui/litellm-dashboard/eslint-metrics.json+++ b/ui/litellm-dashboard/eslint-metrics.json@@ -4,5 +4,5 @@"local/no-large-inline-object-arg": 512,"local/no-long-condition-chain": 233,"max-depth": 59,- "no-console": 15+ "no-console": 16}diff --git a/ui/litellm-dashboard/scripts/check-lint-budgets.mjs b/ui/litellm-dashboard/scripts/check-lint-budgets.mjsindex a7aba18ae76..db0842fb2ec 100644--- a/ui/litellm-dashboard/scripts/check-lint-budgets.mjs+++ b/ui/litellm-dashboard/scripts/check-lint-budgets.mjs@@ -1,4 +1,4 @@-import { readFileSync } from "fs";+import { readFileSync, writeFileSync } from "fs";import { countBudgetViolations, findDrift } from "./lint-budget-lib.mjs";const argv = process.argv.slice(2);@@ -7,6 +7,8 @@ const flags = {};for (let i = 0; i < argv.length; i += 1) {if (argv[i] === "--check") {flags.check = argv[(i += 1)];+ } else if (argv[i] === "--write") {+ flags.write = argv[(i += 1)];} else {positional.push(argv[i]);}@@ -30,6 +32,11 @@ for (const [rule, { max, target }] of Object.entries(budgets)) {}}+if (flags.write) {+ writeFileSync(flags.write, JSON.stringify(counts, null, 2) + "\n");+ console.log(`Wrote ${flags.write}.`);+}+if (flags.check) {const committed = JSON.parse(readFileSync(flags.check, "utf8"));const drift = findDrift(committed, counts);