feat: upgrade to Next.js 15, React 19, and migrate to ESLint 9 flat config

Major framework upgrades:
- Next.js 13 → 15.5.6
- React 18.2.0 → 19.2.0
- ESLint 8 → 9 with flat config migration

Dependency updates:
- @headlessui/react, date-fns, zod, true-myth, usehooks-ts
- @typescript-eslint packages to v8
- TypeScript to v5.9.3
- Prettier to v3.6.2

Breaking changes:
- Migrate from .eslintrc.json to eslint.config.mjs
- Remove deprecated swcMinify option from next.config.mjs
- Update all React type definitions
This commit is contained in:
2025-10-22 01:53:58 -05:00
parent 5fb095a498
commit 66bf588647
9 changed files with 2369 additions and 3962 deletions

View File

@@ -1,22 +0,0 @@
{
"overrides": [
{
"extends": [
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"files": ["*.ts", "*.tsx"],
"parserOptions": {
"project": "tsconfig.json"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/consistent-type-imports": "warn"
}
}

76
eslint.config.mjs Normal file
View File

@@ -0,0 +1,76 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [
// Base configuration with ignores
{
ignores: [
".next/**",
"node_modules/**",
"out/**",
"*.config.mjs",
"*.config.js",
"next-env.d.ts" // Next.js generated file
],
},
// Next.js core web vitals using FlatCompat
...compat.extends("next/core-web-vitals"),
// TypeScript recommended rules
...compat.extends("plugin:@typescript-eslint/recommended"),
// Base TypeScript configuration
{
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
},
rules: {
"@typescript-eslint/consistent-type-imports": "warn",
},
},
// Additional strict TypeScript rules for .ts and .tsx files
{
files: ["**/*.ts", "**/*.tsx"],
...compat.extends("plugin:@typescript-eslint/recommended-requiring-type-checking")[0],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
},
},
// Allow CommonJS require in .cjs files
{
files: ["**/*.cjs"],
rules: {
"@typescript-eslint/no-require-imports": "off",
},
},
];

View File

@@ -8,7 +8,6 @@
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
swcMinify: true,
i18n: {
locales: ["en"],
defaultLocale: "en",

View File

@@ -5,7 +5,7 @@
"scripts": {
"build": "next build",
"dev": "next dev",
"lint": "next lint",
"lint": "eslint .",
"start": "next start",
"test": "vitest",
"test:ui": "vitest --ui",
@@ -15,43 +15,41 @@
"type-check": "tsc --noEmit"
},
"dependencies": {
"@headlessui/react": "^2.0.3",
"@headlessui/react": "^2.2.9",
"@heroicons/react": "^2.0.16",
"@swc/helpers": "^0.5.11",
"clsx": "^2.1.1",
"date-fns": "^2.29.3",
"date-fns": "^4.1.0",
"immutability-helper": "^3.1.1",
"next": "^13",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "^15.5.6",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-hook-form": "^7.42.1",
"react-timeago": "^7.2.0",
"react-timeago": "^8.3.0",
"sass": "^1.57.1",
"true-myth": "^7.1.0",
"usehooks-ts": "^2.9.1",
"zod": "^3.20.2"
"true-myth": "^9.2.0",
"usehooks-ts": "^3.1.1",
"zod": "^4.1.12"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@types/node": "^18.11.18",
"@types/prettier": "^2.7.2",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@types/react-timeago": "^4.1.7",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"@types/node": "^24.9.1",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.46.2",
"@vitest/ui": "^3.2.4",
"autoprefixer": "^10.4.7",
"eslint": "^8.30.0",
"eslint-config-next": "13.1.1",
"eslint": "^9.38.0",
"eslint-config-next": "15.5.6",
"happy-dom": "^20.0.8",
"postcss": "^8.4.14",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.2.1",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.7.1",
"tailwindcss": "^3.2.0",
"type-fest": "^4.18.2",
"typescript": "^4.9.4",
"type-fest": "^5.1.0",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
},
"ct3aMetadata": {

6138
pnpm-lock.yaml generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
import type { FunctionComponent, ReactFragment, ReactNode } from "react";
import type { FunctionComponent, ReactNode } from "react";
import React from "react";
import clsx from "clsx";
type PropertyProps = {
title: string | ReactNode | ReactFragment;
children: string | ReactNode | ReactFragment;
title: string | ReactNode;
children: string | ReactNode;
titleClass?: string;
valueClass?: string;
};

View File

@@ -134,7 +134,7 @@ export function ipv6InCIDR(ip: string, cidr: string): boolean {
const mask = (maxMask << BigInt(128 - prefixLen)) & maxMask;
return (ipInt & mask) === (rangeInt & mask);
} catch (e) {
} catch {
return false;
}
}

View File

@@ -212,7 +212,7 @@ const useLookup = (warningHandler?: WarningHandler) => {
async function getAndParse<T>(
url: string,
schema: ZodSchema
schema: ZodSchema<T>
): Promise<Result<T, Error>> {
const response = await fetch(url);
@@ -366,7 +366,6 @@ const useLookup = (warningHandler?: WarningHandler) => {
)
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const data = await response.json();
// Try each schema until one works
@@ -381,7 +380,6 @@ const useLookup = (warningHandler?: WarningHandler) => {
);
}
case "json": {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const data = JSON.parse(target);
for (const schema of schemas) {
const result = schema.safeParse(data);

View File

@@ -796,7 +796,7 @@ const TypeValidators = new Map<
const octet = parseInt(octets[i] ?? "", 10);
if (isNaN(octet) || octet < 0 || octet > 255) {
return Promise.resolve(
`Invalid IPv4 address: octet ${i + 1} (${octets[i]}) must be 0-255`
`Invalid IPv4 address: octet ${i + 1} (${octets[i] ?? 'undefined'}) must be 0-255`
);
}
}