rusackas opened a new pull request, #44927:
URL: https://github.com/apache/superset/pull/44927
### SUMMARY
CLAUDE.md mandates `@superset-ui/core/components` wrappers over importing
`antd` directly in application code. Six files still didn't follow that, and
nothing was enforcing it, so this closes both gaps.
**The six files** (one was a deep `antd/es/...` import a plain `grep "from
'antd'"` doesn't catch):
- `src/components/Chart/MenuItemWithTruncation.tsx` — only needed
`MenuItemProps['onClick']`'s type. Derived it from the wrapped component
instead: `ComponentProps<typeof Menu.Item>['onClick']`.
- `src/components/Chart/DrillBy/DrillBySubmenu.tsx`,
`src/components/Datasource/ChangeDatasourceModal/index.tsx` — only needed the
`InputRef` type, which `@superset-ui/core/components` already re-exports (via
`Input`'s own `export type { ..., InputRef }`).
- `src/components/Tag/index.tsx` — needed `TagProps`/`CheckableTagProps`,
which the `Tag` wrapper didn't re-export yet. Added that to
`packages/superset-ui-core/src/components/Tag/index.tsx` (both live in
`antd/es/tag`), matching how `Input`/`Menu` already do it.
**Deliberately left alone:**
- `src/theme/utils/antdTokenNames.ts` — introspects antd's own design-token
set at runtime (`theme.getDesignToken()`); there's no wrapper for "list antd's
own tokens."
- `src/theme/tests/ThemeController.test.ts` — asserts against antd's real
`defaultAlgorithm`/`darkAlgorithm` constants to verify the theme integration
itself actually matches antd, not a mock of it.
Both are in `src/theme/`, the same area the sibling `no-literal-colors`
custom rule already exempts for the identical reason ("theme utility functions
legitimately work with [antd internals]").
**Enforcement:** added `checkNoDirectAntdImports` to
`scripts/check-custom-rules.js` (the same pre-commit-wired checker that already
enforces no-literal-colors, no-FontAwesome, etc.), with two exemptions:
`theme/utils` (above) and the `superset-ui-core`/`superset-core` packages
themselves, since they're what the wrappers are built from. Verified it catches
a planted violation and currently reports zero across `src/`.
### TESTING INSTRUCTIONS
```bash
cd superset-frontend
node scripts/check-custom-rules.js # 0 errors (was 2, for the Tag/es deep
import, before this PR)
npx jest src/components/Chart/MenuItemWithTruncation
src/components/Chart/DrillBy \
src/components/Datasource/ChangeDatasourceModal src/components/Tag
```
All 8 affected test suites (64 tests) pass unmodified — no behavior change,
type-only/export-only edits.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]