refactor: rename eslint-config + typescript-config to core-eslint + core-typescript
Aligns tooling packages with the core-* naming convention used by all other foundation packages (core-shared, core-cms, core-api, core-trpc, core-ui). Updates ~50 files: package.json names, devDependencies, tsconfig extends, eslint.config imports, vitest.config imports, AGENTS.md references, and the boundaries plugin patterns to match the new paths. The tooling-specific patterns in boundaries/elements are now ordered BEFORE the broader core-* pattern to ensure correct first-match-wins behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
67
packages/core-eslint/AGENTS.md
Normal file
67
packages/core-eslint/AGENTS.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# AGENTS.md — eslint-config
|
||||
|
||||
Shared ESLint 9 flat configs (rules, plugins, parser settings) consumed by all packages via `eslint.config.js`.
|
||||
|
||||
## 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
|
||||
```
|
||||
47
packages/core-eslint/base.js
Normal file
47
packages/core-eslint/base.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import js from "@eslint/js";
|
||||
import eslintConfigPrettier from "eslint-config-prettier";
|
||||
import tseslint from "typescript-eslint";
|
||||
import turboPlugin from "eslint-plugin-turbo";
|
||||
import boundaries from "eslint-plugin-boundaries";
|
||||
|
||||
export default [
|
||||
{ ignores: ["dist/**", "node_modules/**", ".next/**", ".turbo/**"] },
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
eslintConfigPrettier,
|
||||
{
|
||||
plugins: { turbo: turboPlugin },
|
||||
rules: {
|
||||
"turbo/no-undeclared-env-vars": "warn",
|
||||
},
|
||||
},
|
||||
{
|
||||
plugins: { boundaries },
|
||||
settings: {
|
||||
"boundaries/elements": [
|
||||
{ type: "app", pattern: "apps/*" },
|
||||
{ type: "tooling", pattern: "packages/core-eslint" },
|
||||
{ type: "tooling", pattern: "packages/core-typescript" },
|
||||
{ type: "core-composition", pattern: "packages/core-api" },
|
||||
{ type: "core-composition", pattern: "packages/core-cms" },
|
||||
{ type: "core", pattern: "packages/core-*" },
|
||||
{ type: "feature", pattern: "packages/!(core-*)" },
|
||||
],
|
||||
},
|
||||
rules: {
|
||||
"boundaries/element-types": [
|
||||
2,
|
||||
{
|
||||
default: "disallow",
|
||||
rules: [
|
||||
{ from: "app", allow: ["app", "core", "core-composition", "feature", "tooling"] },
|
||||
{ from: "feature", allow: ["core", "tooling"] },
|
||||
{ from: "core", allow: ["core", "tooling"] },
|
||||
{ from: "core-composition", allow: ["core", "feature", "tooling"] },
|
||||
{ from: "tooling", allow: ["tooling"] },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
3
packages/core-eslint/eslint.config.js
Normal file
3
packages/core-eslint/eslint.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import baseConfig from "./base.js";
|
||||
|
||||
export default baseConfig;
|
||||
6
packages/core-eslint/next.js
Normal file
6
packages/core-eslint/next.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import baseConfig from "./base.js";
|
||||
|
||||
export default [
|
||||
...baseConfig,
|
||||
{ ignores: [".next/**", "out/**"] },
|
||||
];
|
||||
21
packages/core-eslint/package.json
Normal file
21
packages/core-eslint/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@repo/core-eslint",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./base": "./base.js",
|
||||
"./next": "./next.js",
|
||||
"./react-internal": "./react-internal.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.20.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
||||
"@typescript-eslint/parser": "^8.25.0",
|
||||
"eslint": "^9.20.0",
|
||||
"eslint-config-prettier": "^10.1.0",
|
||||
"eslint-plugin-boundaries": "^4.2.2",
|
||||
"eslint-plugin-turbo": "^2.4.0",
|
||||
"typescript-eslint": "^8.25.0"
|
||||
}
|
||||
}
|
||||
3
packages/core-eslint/react-internal.js
vendored
Normal file
3
packages/core-eslint/react-internal.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import baseConfig from "./base.js";
|
||||
|
||||
export default [...baseConfig];
|
||||
Reference in New Issue
Block a user