Skip to content

Conversation

@luiztiago
Copy link
Contributor

This pull request updates the project to support Next.js 16 and React 19, modernizes dependencies, and migrates ESLint configuration to the new flat config format. It also introduces a new proxy.ts middleware file to handle Next.js 16 middleware changes and ensure compatibility with VIP infrastructure.

Framework and Dependency Upgrades:

  • Upgraded next to version 16.0.0, react and react-dom to 19.2.0, @apollo/client to 4.0.9, and updated related type packages to match new major versions. This ensures compatibility with the latest features and security patches. [1] [2]

ESLint Migration and Configuration:

  • Migrated ESLint configuration to the new flat config format by adding eslint.config.mjs and updating lint scripts in package.json. Added new ESLint dependencies (@eslint/eslintrc, @eslint/js) and updated existing ones. [1] [2] [3]

Next.js Middleware Update:

  • Added proxy.ts to replace the legacy middleware.ts, adapting to Next.js 16 conventions. This middleware removes the x-middleware-prefetch header, rewrites healthcheck requests, and sets VIP-specific headers to ensure correct error page handling.

Version Bump:

  • Updated the project version in package.json from 0.1.0 to 0.2.0 to reflect significant changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the project to Next.js 16 and React 19, modernizes the dependency stack, and migrates to ESLint's flat configuration format. A new proxy.ts middleware file is introduced to maintain VIP infrastructure compatibility.

Key Changes:

  • Upgraded core frameworks: Next.js to 16.0.0, React and React-DOM to 19.2.0, and Apollo Client to 4.0.9
  • Migrated ESLint from legacy .eslintrc to flat config format (eslint.config.mjs) with ESLint 9.0.0
  • Added proxy.ts middleware file with VIP-specific header handling and health check routing

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Version bump to 0.2.0; upgraded Next.js, React, TypeScript, ESLint, and testing dependencies; updated lint scripts for flat config
proxy.ts New middleware file handling VIP-specific headers, prefetch header removal, and health check rewrites
eslint.config.mjs New ESLint flat config using FlatCompat for Next.js plugin compatibility
next.config.js Added explicit image optimization defaults for Next.js 16 compatibility with explanatory comments
tsconfig.json Changed jsx compiler from "preserve" to "react-jsx" for React 19 support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 14 to 22
export default [
js.configs.recommended,
...compat.extends('next', 'next/core-web-vitals'),
{
rules: {
// Custom rules can be added here
},
},
];
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new flat config is missing the editorconfig and jest plugins that were configured in the old .eslintrc file. These plugins provided important linting rules (e.g., editorconfig/indent, jest/recommended). Consider adding these plugins to the new config using FlatCompat or ensure the old .eslintrc file is removed to avoid configuration conflicts.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

// Next.js proxy (formerly middleware)
// ===================================
// https://nextjs.org/docs/middleware
// Note: In Next.js 16, middleware.ts has been renamed to proxy.ts
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is incorrect. Next.js 16 did not rename middleware.ts to proxy.ts. The standard middleware convention still uses middleware.ts in Next.js 16. If proxy.ts is being used for VIP-specific infrastructure reasons, the comment should clarify that this is a VIP naming convention, not a Next.js 16 change.

Suggested change
// Note: In Next.js 16, middleware.ts has been renamed to proxy.ts
// Note: This file is named proxy.ts for VIP-specific infrastructure reasons.
// The standard Next.js convention is still middleware.ts, even in Next.js 16.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Copilot AI commented Dec 1, 2025

@luiztiago I've opened a new pull request, #131, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 4 commits December 1, 2025 23:59
Co-authored-by: luiztiago <199867+luiztiago@users.noreply.github.com>
Remove legacy .eslintrc to resolve ESLint flat config conflicts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ingeniumed
Copy link
Contributor

ingeniumed commented Dec 4, 2025

I opened #132 with some fixes to get the skeleton working as right now, if you point it to a WP backend it fails. That can go into this branch

@chriszarate
Copy link
Member

@Automattic/vip-platform-cantina Consider updating this repo with a note saying that it is purely an example, is not maintained, and could harbor future vulnerabilities. Then archive it (with or without this PR). Next.js is a markedly different (worse) framework compared to three years ago (when this repo was developed) and it is much less suitable to our platform.

@luiztiago luiztiago merged commit 9b61f31 into trunk Dec 9, 2025
3 checks passed
@luiztiago luiztiago deleted the update/next_16 branch December 9, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants