- Rename eslint-config → core-eslint, typescript-config → core-typescript in all docs (package map, AGENTS.md, overview.md, dependency-flow.md, etc.) - Document the five-tag model (app, feature, core, core-composition, tooling) — refinement of ADR-006's three-tag mention - Document core-trpc's core-composition tag (transitively reaches features through core-api's AppRouter type) - Note Turborepo boundaries as a second enforcement layer alongside ESLint - Add ADR-010 explaining the two-layer enforcement decision and five-tag refinement Files updated: - docs/architecture/overview.md: package map, enforcement layers, five-tag section - docs/architecture/dependency-flow.md: boundary rules, enforcement strategy - docs/architecture/vertical-feature-spec.md: package names, five-tag model - AGENTS.md: package map, boundary rules, commands - CLAUDE.md: tooling package names, quick-start command - packages/core-eslint/AGENTS.md: tag clarification - packages/core-typescript/AGENTS.md: tag clarification - packages/core-api/AGENTS.md: core-composition tag - packages/core-cms/AGENTS.md: core-composition tag - packages/core-trpc/AGENTS.md: core-composition tag + rationale - docs/decisions/adr-010-turbo-boundaries.md: new ADR Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
2.2 KiB
Markdown
70 lines
2.2 KiB
Markdown
# AGENTS.md — core-eslint
|
|
|
|
**Tag:** tooling
|
|
|
|
Shared ESLint 9 flat configs (rules, plugins, parser settings) consumed by all packages via `eslint.config.js`. Enforces boundary rules alongside Turborepo's `boundaries` feature (which validates the workspace dependency graph at build time).
|
|
|
|
## What it owns
|
|
|
|
- **`base.js`** — Core ESLint rules: no `console`, no `debugger`, strict `@typescript-eslint` config
|
|
- **`next.js`** — Next.js-specific rules: `"use client"` boundaries, `next/no-img-element`
|
|
- **`react-internal.js`** — React library rules: component display names, hook rules
|
|
- **`boundaries.js`** — `eslint-plugin-boundaries` config enforcing vertical feature architecture:
|
|
- Features may only import `core-*` and tooling packages
|
|
- Core packages may only import other core packages (with composition exceptions for `core-cms`, `core-api`)
|
|
- No cross-feature imports
|
|
- No deep source path imports (only public subpath exports)
|
|
|
|
## How packages consume them
|
|
|
|
Each package creates `eslint.config.js` at its root:
|
|
|
|
```javascript
|
|
// packages/blog/eslint.config.js
|
|
import baseConfig from "@repo/core-eslint/base";
|
|
import boundariesConfig from "@repo/core-eslint/boundaries";
|
|
|
|
export default [
|
|
...baseConfig,
|
|
...boundariesConfig,
|
|
{
|
|
files: ["src/**/*.tsx"],
|
|
rules: {
|
|
"react/display-name": "off",
|
|
},
|
|
},
|
|
];
|
|
```
|
|
|
|
Apps may add Next.js-specific rules:
|
|
|
|
```javascript
|
|
// apps/web-next/eslint.config.js
|
|
import baseConfig from "@repo/core-eslint/base";
|
|
import nextConfig from "@repo/core-eslint/next";
|
|
import boundariesConfig from "@repo/core-eslint/boundaries";
|
|
|
|
export default [
|
|
...baseConfig,
|
|
...nextConfig,
|
|
...boundariesConfig,
|
|
];
|
|
```
|
|
|
|
## Test conventions
|
|
|
|
- No unit tests (config validation via lint pass/fail in other packages)
|
|
- Verify at CI: `pnpm lint` succeeds across all packages
|
|
- ESLint should catch boundary violations: `pnpm lint` fails on feature→feature imports or deep imports
|
|
|
|
## Structure
|
|
|
|
```
|
|
src/
|
|
base.js # Core TypeScript + ESLint config
|
|
next.js # Next.js additions
|
|
react-internal.js # React library rules
|
|
boundaries.js # Feature boundaries + composition rules
|
|
index.js # Re-exports all configs
|
|
```
|