chore(tracker-web): add @bytelyst/ui UI-drift ratchet eslint rule (CC.6)

Forbid direct @bytelyst/ui imports outside the Primitives adapter via
no-restricted-imports, with the adapter file exempted. No pre-existing
violations; a probe confirms the rule fires.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
saravanakumardb1 2026-05-28 20:39:20 -07:00
parent 18a09b25b8
commit 73d2891d8e
2 changed files with 46 additions and 14 deletions

View File

@ -182,7 +182,7 @@ pnpm build # final gate
adapter (preserves the UI-drift ratchet).
- [x] **9.2** Add `src/__tests__/primitives-adapter.exports.test.ts` asserting every adapter
export is `defined` (a pure import test — raises `Primitives.tsx` off 0% without a DOM dep).
**Verify:** `pnpm typecheck && pnpm lint && pnpm test && pnpm build`. (UX-9 verified: tc/lint/test 159 ✓/build/e2e 18 ✓)
**Verify:** `pnpm typecheck && pnpm lint && pnpm test && pnpm build`. (UX-9 `18a09b25`: tc/lint/test 159 ✓/build/e2e 18 ✓)
## UX-10 — Page chrome via `@bytelyst/dashboard-components`
@ -238,9 +238,10 @@ pnpm build # final gate
and `/login`; otherwise Vitest render assertions for roles/labels.
- [ ] **CC.5** Update master `docs/ROADMAP.md` Phase 2.1 checkboxes **only if** the operator asks —
default: leave it, this doc is the source of truth for the integration.
- [ ] **CC.6** **UI-drift ratchet:** once UX-9 lands, add an ESLint `no-restricted-imports` rule
- [x] **CC.6** **UI-drift ratchet:** once UX-9 lands, add an ESLint `no-restricted-imports` rule
forbidding direct `@bytelyst/ui` imports outside `src/components/ui/Primitives.tsx`, so all
future UI goes through the adapter. Fix any existing violations in the same commit.
(Done: rule + adapter exemption in `eslint.config.mjs`; no pre-existing violations; probe confirms it fires.)
- [ ] **CC.7** **Bundle budget:** after chart/motion/rich-text waves, re-check the `bundlesize`
budgets in `package.json`. If a route grows, prefer dynamic `import()` for heavy surfaces
(charts, rich-text editor) over raising a budget. Note the gzipped sizes in the log.

View File

@ -1,24 +1,55 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
import { defineConfig, globalIgnores } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';
import nextTs from 'eslint-config-next/typescript';
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
{
rules: {
"react-hooks/set-state-in-effect": "off",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" }],
'react-hooks/set-state-in-effect': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
// CC.6 UI-drift ratchet: all @bytelyst/ui usage must go through the
// Primitives adapter so future UI stays consistent and centrally swappable.
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@bytelyst/ui',
message:
'Import @bytelyst/ui components via the adapter: src/components/ui/Primitives.tsx (UI-drift ratchet, CC.6).',
},
],
patterns: [
{
group: ['@bytelyst/ui/*'],
message:
'Import @bytelyst/ui components via the adapter: src/components/ui/Primitives.tsx (UI-drift ratchet, CC.6).',
},
],
},
],
},
},
{
// The adapter itself is the single sanctioned place to import @bytelyst/ui.
files: ['src/components/ui/Primitives.tsx'],
rules: {
'no-restricted-imports': 'off',
},
},
globalIgnores([
".next/**",
"out/**",
"build/**",
"coverage/**",
"test-results/**",
"playwright-report/**",
"next-env.d.ts",
'.next/**',
'out/**',
'build/**',
'coverage/**',
'test-results/**',
'playwright-report/**',
'next-env.d.ts',
]),
]);