@teamix-evo/eslint-config
v0.3.5
Published
Shared ESLint config and custom rules for Teamix Evo (token discipline, shadcn engineering contract)
Readme
@teamix-evo/eslint-config
ESLint v9 flat config、Teamix Evo token discipline 与 shadcn v4 工程契约。规则实现
与导出以 src/index.ts 为机器真值,当前共 16 条:
| 规则 | 约束 |
| --- | --- |
| no-color-literal | 禁止代码中的颜色字面量 |
| no-arbitrary-tw-value | 禁止 Tailwind arbitrary value |
| no-raw-color-scale | 禁止直接使用 Tailwind 原始色阶 |
| no-large-radius | 禁止超出允许档位的大圆角 |
| no-bare-border | border 必须配套语义边框色 |
| no-relative-ui-import | UI 源码使用项目 alias |
| no-relative-cross-boundary | 禁止相对路径穿越包/层级边界 |
| icon-from-lucide | UI icon 统一来自 lucide-react |
| prefer-gap-over-space | 布局间距优先使用 gap |
| no-manual-dark-classnames | 禁止组件手写品牌 dark 分支 |
| dialog-must-have-title | Dialog 必须有可访问标题 |
| no-legacy-shadcn-import | 禁止旧 shadcn import 形态 |
| require-data-slot | 可静态证明的公开根节点必须有 data-slot |
| prefer-cn-merge | 条件 class 使用统一 cn 合并 |
| require-forward-ref | 有公开 ref/Slot 契约的 React 18 组件必须转发 ref |
| no-inline-style-literal | 禁止可由 token/utility 表达的 inline style 字面量 |
使用
// eslint.config.js
import teamixEvoUi from '@teamix-evo/eslint-config/presets/ui';
export default teamixEvoUi;消费项目使用:
import teamixEvoConsumer from '@teamix-evo/eslint-config/presets/consumer';
export default teamixEvoConsumer;也可以从包根导入 rules 或 plugin 选择单条规则。准确 preset 组合以
src/presets/ui.ts、src/presets/consumer.ts 为准。
架构
ESLint 与 Stylelint 共享的 token matcher、allowlist 和基础解析位于私有
@teamix-evo/lint-core。发布构建必须把内部实现打包,不能向 npm 消费方泄漏
workspace:* runtime 依赖,见
ADR 0012。
验证
pnpm --filter @teamix-evo/eslint-config typecheck
pnpm --filter @teamix-evo/eslint-config test
pnpm --filter @teamix-evo/eslint-config validate规则设计原则见 docs/principles.md P4/P5,UI 作用域与
例外边界见 packages/ui/AGENTS.md。
