From 73d2891d8e0a74aa7b1cc5e4e6246d0e578b388b Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Thu, 28 May 2026 20:39:20 -0700 Subject: [PATCH] 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> --- .../docs/roadmaps/UX_INTEGRATION_BYTELYST.md | 5 +- dashboards/tracker-web/eslint.config.mjs | 55 +++++++++++++++---- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/dashboards/tracker-web/docs/roadmaps/UX_INTEGRATION_BYTELYST.md b/dashboards/tracker-web/docs/roadmaps/UX_INTEGRATION_BYTELYST.md index 1e15a888..fc447597 100644 --- a/dashboards/tracker-web/docs/roadmaps/UX_INTEGRATION_BYTELYST.md +++ b/dashboards/tracker-web/docs/roadmaps/UX_INTEGRATION_BYTELYST.md @@ -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. diff --git a/dashboards/tracker-web/eslint.config.mjs b/dashboards/tracker-web/eslint.config.mjs index 36715651..b87bdcfe 100644 --- a/dashboards/tracker-web/eslint.config.mjs +++ b/dashboards/tracker-web/eslint.config.mjs @@ -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', ]), ]);