@teamix-evo/eslint-config
v0.3.0
Published
Shared ESLint config and custom rules for Teamix Evo (token discipline, shadcn engineering contract)
Downloads
588
Readme
@teamix-evo/eslint-config
Shared ESLint v9 flat config + custom rules that enforce Teamix Evo's design-token discipline and shadcn v4 engineering contract (ADR 0036) — machine-checking the constraints that used to live only in
packages/ui/AGENTS.md.
Why
PLAN.md §12.3 P0-2 and docs/adr/0001-three-layer-alignment.md state the core failure mode of teamix-evo's current state: AGENTS.md (~30KB across multiple files) carries 80% of the engineering constraints in textual form. Every line of textual rule that AI / humans can ignore is a leak in the dam.
This package closes the leaks by turning each red-line rule into a machine-checked ESLint rule.
Rules shipped
| Rule | Layer (per §2.2 knowledge energy gradient) | What it forbids | Replaces text in |
| ----------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
| no-color-literal | Foundations | Hex / rgb() / hsl() literals in code | packages/ui/AGENTS.md §三.B "禁止 arbitrary values" |
| no-arbitrary-tw-value | Foundations | bg-[#fff], mt-[7px], text-[14px] | packages/ui/AGENTS.md §三.B "禁止 arbitrary values" |
| no-raw-color-scale | Foundations | bg-red-500, text-blue-700 (raw Tailwind palette) | packages/ui/AGENTS.md §三.B "禁止原色阶" |
| no-large-radius | Foundations | rounded-3xl and above | packages/ui/AGENTS.md §三.B "禁用 rounded-3xl 及以上" |
| no-bare-border | Foundations | Bare border / border-{side} without a border-{color} companion (autofix appends border-border) | packages/ui/AGENTS.md §三.B "裸 border 永远不合法" |
| no-relative-ui-import | Patterns | Relative imports in packages/ui/src/ (must use @/ alias) | packages/ui/AGENTS.md §三.A "假路径" |
| icon-from-lucide | Patterns | Importing icons from non-lucide-react packages in UI sources | packages/ui/AGENTS.md §三.C "icon 来源固定 lucide-react" |
Usage
As a flat config
// eslint.config.js (in packages/ui or any consumer)
import teamixEvoUi from '@teamix-evo/eslint-config/presets/ui';
export default teamixEvoUi;Picking individual rules
import { rules } from '@teamix-evo/eslint-config';
export default [
{
plugins: { 'teamix-evo': { rules } },
rules: {
'teamix-evo/no-color-literal': 'error',
'teamix-evo/no-arbitrary-tw-value': 'error',
// ...
},
},
];Presets
@teamix-evo/eslint-config/presets/ui— applies all 6 rules aterrorlevel. Forpackages/ui/.@teamix-evo/eslint-config/presets/consumer— same 6 rules butno-relative-ui-importandicon-from-lucideare scoped tosrc/components/ui/**only (so business-side custom components aren't constrained). For business-side projects landed viacreate-teamix-evo.
Severity guidance
All 6 rules are red-line / error level by design (see docs/adr/ and PLAN §12.11). Do not soften them to warn — that defeats the purpose. If you find a legitimate case the rule blocks, file an ADR proposing the rule change, or use the rule's documented escape hatch (e.g. file-level // eslint-disable with required reason comment, enforced by future enforce-disable-reason rule).
Adding a new rule
Each rule needs three things:
- Implementation in
src/rules/<rule-id>.ts(usecreateRulefrom@typescript-eslint/utils) - Test in
tests/<rule-id>.test.ts(useRuleTester) - An ADR in
docs/adr/numbered in0100–0999region explaining why this rule exists, what AGENTS.md text it replaces, and what the consequences are.
