fix(core-eslint): activate React rules-of-hooks for all TSX surfaces
next.js and react-internal.js are plain re-exports of base, so no rules-of-hooks checking was active anywhere despite three React apps and core-ui. Wire eslint-plugin-react-hooks in base.js scoped to **/*.tsx (non-React packages untouched). Fixes the one violation it surfaced: web-tanstack's root route called Route.useLoaderData inside an anonymous component callback — extracted to a named RootComponent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import eslintConfigPrettier from "eslint-config-prettier";
|
||||
import tseslint from "typescript-eslint";
|
||||
import turboPlugin from "eslint-plugin-turbo";
|
||||
import boundaries from "eslint-plugin-boundaries";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
import globals from "globals";
|
||||
import conformancePlugin from "./plugin.js";
|
||||
import path from "node:path";
|
||||
@@ -195,6 +196,13 @@ export default [
|
||||
"no-restricted-imports": "off",
|
||||
},
|
||||
},
|
||||
// React rules-of-hooks for every TSX surface (apps, core-ui, feature
|
||||
// ui/**). Scoped to .tsx so non-React packages are untouched.
|
||||
{
|
||||
files: ["**/*.tsx"],
|
||||
plugins: { "react-hooks": reactHooks },
|
||||
rules: reactHooks.configs.recommended.rules,
|
||||
},
|
||||
// E1 — Event handlers must not be re-exported. Wire them only inside the
|
||||
// consumer feature's bind-production / bind-dev-seed (spec § 2.2 Rule E1).
|
||||
// J — Direct `payload.jobs.*` access is forbidden outside the integration
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"eslint": "^9.20.0",
|
||||
"eslint-config-prettier": "^10.1.0",
|
||||
"eslint-plugin-boundaries": "^4.2.2",
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-turbo": "^2.4.0",
|
||||
"typescript-eslint": "^8.25.0",
|
||||
"vitest": "^3.1.0"
|
||||
|
||||
Reference in New Issue
Block a user