feat(deps): Next 15 → 16 (proxy.ts rename + native flat ESLint config)
Applied @next/codemod migrations: - middleware-to-proxy: src/middleware.ts → src/proxy.ts + function rename - remove-experimental-ppr: no hits - remove-unstable-prefix: no hits tsconfig.json picked up Next 16's autofixes: - jsx: 'preserve' → 'react-jsx' - include .next/dev/types/**/*.ts (dev-mode route types) - next-env.d.ts: triple-slash reference → ES import (TS 6 / Next 16 style) eslint-config-next@16 ships a native flat config, so dropped the @eslint/eslintrc + FlatCompat shim. eslint.config.mjs now imports eslint-config-next/core-web-vitals + eslint-config-prettier/flat directly. Note on ESLint 10: bumped + reverted. eslint-config-next@16 still has a transitive eslint-plugin-react@7 that uses the eslint-9 context API (getFilename on context); breaks under eslint 10. Audit anticipated lockstep — but the transitive isn't ready yet. Holding at eslint 9.x until upstream lands. Tracked in BACKLOG. React Compiler safety rules (react-hooks v7) shipped with config- next 16 surfaced ~89 legitimate findings (set-state-in-effect, ref-during-render, immutability). Demoted the new rules to `warn` so the codebase isn't blocked; triage tracked in BACKLOG §G. Verified: tsc 0 errors, eslint 0 errors / 105 warnings (89 new Compiler-rule warns + 16 pre-existing), next build clean, custom server build clean, vitest 1315/1315. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,36 +1,40 @@
|
||||
import { dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals';
|
||||
import prettier from 'eslint-config-prettier/flat';
|
||||
|
||||
const eslintConfig = [
|
||||
...compat.extends("next/core-web-vitals", "next/typescript", "prettier"),
|
||||
...nextCoreWebVitals,
|
||||
prettier,
|
||||
{
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_" },
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
// React Compiler safety rules that ship with eslint-config-next@16 /
|
||||
// react-hooks@7. These flag setState-in-effect, ref-during-render,
|
||||
// and impurity patterns that the upcoming React Compiler will trip
|
||||
// on. They surfaced ~73 hits in the existing codebase on the
|
||||
// next-16 bump — all legitimate findings but a clean-up project
|
||||
// worth a dedicated triage pass, not a blocker for the dep
|
||||
// upgrade. Demoted to warnings so the suite stays visible without
|
||||
// turning every commit red. Tracked in docs/BACKLOG.md §G.
|
||||
'react-hooks/set-state-in-effect': 'warn',
|
||||
'react-hooks/set-state-in-render': 'warn',
|
||||
'react-hooks/refs': 'warn',
|
||||
'react-hooks/immutability': 'warn',
|
||||
'react-hooks/purity': 'warn',
|
||||
'react-hooks/incompatible-library': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
// Tests assert response shape via expect() — narrowing every
|
||||
// `res.json()` to a structural type adds boilerplate without catching
|
||||
// bugs. Allow `any` casts at JSON boundaries in test files.
|
||||
files: ["tests/**/*.ts", "tests/**/*.tsx"],
|
||||
files: ['tests/**/*.ts', 'tests/**/*.tsx'],
|
||||
rules: {
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ["client-portal/**", "next-env.d.ts"],
|
||||
ignores: ['client-portal/**', 'next-env.d.ts'],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user