feat(ui-kit): add CI guardrail against app-logic imports#4902
Merged
Conversation
Adds a dedicated packages/ui-kit/eslint.config.js whose no-restricted-imports rule fails on @tanstack/react-router, @tanstack/react-query, or any import resolving into apps/ui/** -- the package's whole point is staying a real, standalone library, and without an enforced boundary that regresses silently as components keep getting added. Verified the rule actually fires (not just that the config compiles): added a temporary file importing all three restricted patterns, ran the lint, confirmed all three error correctly with actionable messages, then removed it. Wires a new "Lint packages/ui-kit (app-logic import guardrail)" step into validate.yml alongside the existing typecheck/test/build-drift steps for the package. Documents the boundary in packages/ui-kit's own README (also fixing its stale "scaffold only" status left over from #4860, and the reference to PlaceholderCard which #4862 already removed) and in the metagraphed skill's reference.md.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-data-api | eddb063 | Commit Preview URL Branch Preview URL |
Jul 11 2026, 03:12 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-registry-sync-api | eddb063 | Jul 11 2026, 03:12 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-ui | eddb063 | Commit Preview URL Branch Preview URL |
Jul 11 2026, 03:13 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4902 +/- ##
=======================================
Coverage 97.87% 97.87%
=======================================
Files 162 162
Lines 19872 19872
Branches 7451 7451
=======================================
Hits 19449 19449
Misses 59 59
Partials 364 364 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4865 (part of the
packages/ui-kitextraction epic, #4867).The entire point of
packages/ui-kitis that it's a real, standalone, dependency-free library — the moment a component inside it imports something app-specific (@tanstack/react-router,@tanstack/react-query, anapps/ui-local file), the extraction has silently regressed back into the exact problem this epic exists to fix. Nothing in #4862/#4863/#4864 structurally prevented that from creeping back in over time. This adds the enforced boundary.What this adds
packages/ui-kit/eslint.config.js— a dedicated flat-config ESLint setup for the package (mirrorsapps/ui/eslint.config.js's shape:@eslint/js+typescript-eslint+eslint-plugin-react-hooks+eslint-plugin-prettier). Itsno-restricted-importsrule fails on:@tanstack/react-router(exact package match)@tanstack/react-query(exact package match)apps/ui/**(pattern match — catches relative-path escapes too, e.g.../../../apps/ui/...)Each violation gets an actionable message pointing at the fix (accept as a prop instead of importing app infrastructure).
CI wiring: a new "Lint packages/ui-kit (app-logic import guardrail)" step in
validate.yml, alongside the existing typecheck/test/build-drift steps for the package — a violation fails the PR the same way any other lint error does, no separate opt-in.Docs:
packages/ui-kit/README.mdnow states the boundary rule in plain language (also fixed its stale "scaffold only" status left over from Scaffold packages/ui-kit as a real buildable library package #4860, and removed the reference toPlaceholderCard, which Migrate components/ui/* primitives (8 files) into packages/ui-kit #4862 already deleted — found while updating the file for this PR). The metagraphed skill'sreference.mdalso documents the new CI step.Confirmed the rule actually fires
Per the issue's explicit requirement — didn't just trust the config compiles. Added a temporary file with all three violation types:
Ran
npm run lint --workspace=packages/ui-kit— all three errored correctly with their custom messages. Removed the file, confirmed clean again.Validation
npm run lint --workspace=packages/ui-kit— clean against the existing (real) codebase, confirming Migrate components/ui/* primitives (8 files) into packages/ui-kit #4862-Migrate chart primitives (components/metagraphed/charts/*) into packages/ui-kit #4864 never actually introduced a violationnpm run typecheck --workspace=packages/ui-kit— cleannpm run build --workspace=packages/ui-kit— cleannpm test --workspace=packages/ui-kit— 9/9 files, 52/52 tests passingnpm run typecheck --workspace=apps/ui— clean (untouched by this PR, sanity-checked anyway)npx prettier --checkon all touched files — cleaneslint.config.mjsdoesn't conflict — it only ever covered.mjsfiles repo-wide (never.ts/.tsx, not even forpackages/client), sopackages/ui-kit's new config is purely additive, no double-linting or config clashNo visual changes — this PR touches only tooling config, CI workflow, and docs, not
apps/uicomponent code.