Compile Error Root Cause
Explains why react-next-admin and common compile differently: same source, different ESLint config.
Compile Error Root Cause: react-next-admin vs common
Symptom
The same source file src/common/lib/table/DataTableProperty.ts produces two errors in react-next-admin during next build, while common compiles fine:
6:17 Error: 'PagerResult' is defined but never used. @typescript-eslint/no-unused-vars
33:14 Error: The `{}` ("empty object") type allows any non-nullish value...
Root Cause
Key point: the file is identical in both projects — the difference is not in the code but in each project's ESLint config.
react-next-admin/package.json has a copy script that syncs common's shared directory into this project:
"copy": "cpy ./../common/src/common ./src/ --parents"
So react-next-admin/src/common is copied from common/src/common and the code is exactly the same. The error difference comes from the two projects using different ESLint presets:
| Project | eslint.config.mjs extends | TS strict rules enabled |
|---|---|---|
| react-next-admin | next/core-web-vitals + next/typescript | Yes |
| common | next | No |
next/typescript expands to plugin:@typescript-eslint/recommended, which turns on two rules matching the two errors:
@typescript-eslint/no-unused-vars→PagerResultis imported but never used@typescript-eslint/ban-types→ the empty object type{}inparent?: {}
common only extends next (without next/typescript), so these rules are never enabled and no error appears.
Relationship to Compilation
Both errors are ESLint rule errors, not TypeScript (tsc) type errors.
next build runs ESLint during the build phase; when a rule is at the error level, a lint failure aborts the build — which is why it surfaces as a "compile error". In other words:
- The TypeScript type system does not consider either spot an error (
{}is a legal type, and an unused named import does not affect type checking); - It is ESLint's static check that escalates them to
error, which then blocksnext build.
Fix Suggestions
- Fix the source (recommended): remove the unused
PagerResultimport; changeparent?: {}toparent?: object(or a more specific type). - Align the configs: make both projects use the same ESLint preset — either both extend
next/typescriptand fix the source, or explicitly disable these two rules on thecommonside.
Note:
react-next-admin/src/commonis a copy artifact; editing it directly will be overwritten on the nextnpm run copy. The correct place to fix iscommon/src/common(the source), then run the copy to sync.