Skip to content

chore(ui): soften antd import ban from error to warn - #34354

Open
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_ui_antd_import_warn
Open

chore(ui): soften antd import ban from error to warn#34354
ryan-crabbe-berri wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_ui_antd_import_warn

Conversation

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

  • Splits antd into its own warn-level rule so new imports surface without failing CI
  • Keeps the tremor ban a hard error and prunes the stale antd suppressions

Relevant issues

Follows up on #34341

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

This is lint tooling with no runtime surface, so the proof is the gate itself. Captured at the branch HEAD

The whole repo still passes; antd imports are now warnings, not errors

$ npx eslint . ; echo "exit=$?"
exit=0

A new antd-only file no longer blocks (the refactor unblock case)

$ cat src/Widget.tsx
import { Button } from "antd";
export const Widget = () => <Button>ok</Button>;

$ npx eslint src/Widget.tsx ; echo "exit=$?"
  1:24  warning  antd is being phased out; build new UI with shadcn/ui primitives instead of adding antd imports  local/no-antd-import
exit=0

A file adding a new tremor import still fails, so that gate is untouched

$ npx eslint src/Widget.tsx   # with: import { Card } from "@tremor/react";
  2:1  error  '@tremor/react' import is restricted from being used by a pattern ...  no-restricted-imports
✖ 1 problem (1 error, 1 warning)

The new rule ships with RuleTester coverage

$ npx vitest run tests/eslint-rules/no-antd-import.test.ts
 ✓ tests/eslint-rules/no-antd-import.test.ts (12 tests)
 Test Files  1 passed (1)
      Tests  12 passed (12)

Type

🚄 Infrastructure

Changes

The antd ban shipped in #34341 as an error under no-restricted-imports. That blocks any antd to shadcn/ui refactor that moves or edits a file still importing antd, because the moved import lands without a matching suppression and fails CI

This splits antd into a dedicated local/no-antd-import rule set to warn, so new antd imports stay visible during the migration without failing the build. The tremor ban keeps its error severity under no-restricted-imports, so nothing there loosens. The now-stale antd suppressions are pruned, which drops no-restricted-imports from 625 back to its tremor-only baseline of 180

The new rule covers static imports, export ... from, dynamic import(), require, and deep antd/* paths, with RuleTester tests for each

Once the antd migration lands, this can be re-promoted to error (optionally with a budget) in a later pass

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

The antd ban shipped in the prior lint pass as an error under
no-restricted-imports, which blocks in-flight antd -> shadcn/ui refactors
whenever they move or touch a file that still imports antd. Split antd out
into a dedicated local/no-antd-import rule set to warn so new antd imports
stay visible without failing CI, while the tremor ban stays a hard error.
Pruned the now-stale antd suppressions, dropping no-restricted-imports back
to its tremor-only baseline (625 -> 180)

The new rule ships with RuleTester coverage over import, export-from,
dynamic import, require, and deep antd/* paths
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR downgrades the antd import ban from a CI-blocking error to a warning by extracting it into a dedicated local/no-antd-import custom ESLint rule, unblocking in-flight antd → shadcn/ui refactors. The tremor ban remains a hard error under no-restricted-imports.

  • A new no-antd-import.mjs rule covers all import surfaces (static import, export … from, dynamic import(), and require()) and ships with 12 RuleTester cases covering valid and invalid patterns.
  • eslint.config.mjs wires the new rule at warn and removes antd from no-restricted-imports; eslint-suppressions.json is pruned accordingly to remove the now-stale antd suppression entries.

Confidence Score: 5/5

Safe to merge — changes are limited to ESLint tooling with no runtime surface, and all stated gates (tremor error, antd warning, full-repo exit 0) are verified in the PR description.

The rule implementation is correct and handles every antd import variant. The suppression file is consistently updated to match the new rule split. Tests are thorough and targeted. No runtime code is touched.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/scripts/eslint-rules/no-antd-import.mjs New custom ESLint rule correctly detects antd imports across static imports, re-exports, dynamic import(), and require() using a precise regex; no logic issues found.
ui/litellm-dashboard/tests/eslint-rules/no-antd-import.test.ts RuleTester covers all five import variants (static, re-export named, re-export all, dynamic import, require) and the false-positive guard cases; coverage is adequate.
ui/litellm-dashboard/eslint.config.mjs Antd removed from no-restricted-imports (error), added as local/no-antd-import (warn); tremor ban unchanged at error; clean split with no unintended rule changes.
ui/litellm-dashboard/scripts/eslint-rules/index.mjs New no-antd-import rule registered in the local plugin under the correct key; no issues.
ui/litellm-dashboard/eslint-suppressions.json antd-only no-restricted-imports entries removed; counts for files with remaining tremor entries correctly decremented; consistent with the rule change.

Reviews (1): Last reviewed commit: "chore(ui): soften antd import ban from e..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_ui_antd_import_warn (5c43cb9) with litellm_internal_staging (0c2b86e)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (eb2dce8) during the generation of this report, so 0c2b86e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant