learning_ai_common_plat/dashboards/admin-web/eslint.config.mjs
saravanakumardb1 df72199cd1 feat(admin-web): --bl-* token bridge + UI-drift ratchet + baseline audit (UX-1)
Additive phase-1 foundation for ByteLyst UX integration:
- globals.css: bridge the shared --bl-* contract onto admin's shadcn OKLCH
  ramp (surfaces/borders/text/accent/danger/focus) so @bytelyst/* components
  theme correctly in light AND dark. Mappings reference admin --* vars that
  flip under .dark, so parity is inherited with zero new color literals.
  Status hues (success/warning/info) intentionally inherit design-tokens.
- eslint.config.mjs: no-restricted-imports ratchet forbidding direct
  @bytelyst/ui imports outside the Primitives.tsx adapter seam.
- primitives-exports.test.ts: export-presence guard for the adapter surface.
- roadmap: author verified baseline audit + green/red gate table + e2e baseline.

Verify: typecheck+lint+build green; vitest 17 files / 140 tests (+29);
format:check no new failures (29 pre-existing, out of scope); e2e baseline
11 passed / 80 failed (80 environmental — no backend).

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-05-29 13:25:00 -07:00

79 lines
2.7 KiB
JavaScript

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([
// Ignores MUST come first so they apply to every subsequent
// config item. globalIgnores() at the bottom of the array works
// for *.next / out / build / next-env.d.ts because eslint-config-
// next handles those internally, but .pnpmfile.cjs is not in that
// default list — declaring an explicit `{ ignores: [...] }` block
// at index 0 is the documented way to make eslint v9 skip files
// entirely before any config rules apply.
{
ignores: ['**/.pnpmfile.cjs', '**/*.cjs'],
},
...nextVitals,
...nextTs,
{
rules: {
'react-hooks/set-state-in-effect': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
},
},
// UX-drift ratchet (UX-1): shared `@bytelyst/ui` primitives must be adopted
// through the local adapter `src/components/ui/Primitives.tsx`, never imported
// directly into pages/components. This keeps product-specific variants, the
// `--bl-*` token bridge, and a single migration seam in one place (the
// exception below). Mirrors tracker-web's convention.
{
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@bytelyst/ui',
message:
"Import shared UI primitives via '@/components/ui/Primitives' instead of '@bytelyst/ui' directly (UX-drift ratchet — see docs/roadmaps/UX_INTEGRATION_ADMIN.md).",
},
],
patterns: [
{
group: ['@bytelyst/ui/*'],
message:
"Import shared UI primitives via '@/components/ui/Primitives' instead of '@bytelyst/ui/*' directly (UX-drift ratchet — see docs/roadmaps/UX_INTEGRATION_ADMIN.md).",
},
],
},
],
},
},
// The Primitives adapter is the ONE sanctioned seam for `@bytelyst/ui`.
{
files: ['src/components/ui/Primitives.tsx'],
rules: {
'no-restricted-imports': 'off',
},
},
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
'.next/**',
'out/**',
'build/**',
'next-env.d.ts',
// .pnpmfile.cjs is a pnpm install hook (CommonJS by design).
// The TypeScript no-require-imports rule would otherwise flag
// every require() call in this file. eslint-config-next does NOT
// ignore .cjs by default.
'.pnpmfile.cjs',
'**/*.cjs',
]),
]);
export default eslintConfig;