mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-07 07:16:04 -06:00
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:
@@ -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
76
eslint.config.mjs
Normal 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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
swcMinify: true,
|
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: ["en"],
|
locales: ["en"],
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
|
|||||||
44
package.json
44
package.json
@@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"lint": "next lint",
|
"lint": "eslint .",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"test:ui": "vitest --ui",
|
"test:ui": "vitest --ui",
|
||||||
@@ -15,43 +15,41 @@
|
|||||||
"type-check": "tsc --noEmit"
|
"type-check": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@headlessui/react": "^2.0.3",
|
"@headlessui/react": "^2.2.9",
|
||||||
"@heroicons/react": "^2.0.16",
|
"@heroicons/react": "^2.0.16",
|
||||||
"@swc/helpers": "^0.5.11",
|
"@swc/helpers": "^0.5.11",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^2.29.3",
|
"date-fns": "^4.1.0",
|
||||||
"immutability-helper": "^3.1.1",
|
"immutability-helper": "^3.1.1",
|
||||||
"next": "^13",
|
"next": "^15.5.6",
|
||||||
"react": "18.2.0",
|
"react": "19.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "19.2.0",
|
||||||
"react-hook-form": "^7.42.1",
|
"react-hook-form": "^7.42.1",
|
||||||
"react-timeago": "^7.2.0",
|
"react-timeago": "^8.3.0",
|
||||||
"sass": "^1.57.1",
|
"sass": "^1.57.1",
|
||||||
"true-myth": "^7.1.0",
|
"true-myth": "^9.2.0",
|
||||||
"usehooks-ts": "^2.9.1",
|
"usehooks-ts": "^3.1.1",
|
||||||
"zod": "^3.20.2"
|
"zod": "^4.1.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@types/node": "^18.11.18",
|
"@types/node": "^24.9.1",
|
||||||
"@types/prettier": "^2.7.2",
|
"@types/react": "^19.2.2",
|
||||||
"@types/react": "^18.0.26",
|
"@types/react-dom": "^19.2.2",
|
||||||
"@types/react-dom": "^18.0.10",
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
||||||
"@types/react-timeago": "^4.1.7",
|
"@typescript-eslint/parser": "^8.46.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.47.1",
|
|
||||||
"@typescript-eslint/parser": "^5.47.1",
|
|
||||||
"@vitest/ui": "^3.2.4",
|
"@vitest/ui": "^3.2.4",
|
||||||
"autoprefixer": "^10.4.7",
|
"autoprefixer": "^10.4.7",
|
||||||
"eslint": "^8.30.0",
|
"eslint": "^9.38.0",
|
||||||
"eslint-config-next": "13.1.1",
|
"eslint-config-next": "15.5.6",
|
||||||
"happy-dom": "^20.0.8",
|
"happy-dom": "^20.0.8",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.14",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.2.1",
|
"prettier-plugin-tailwindcss": "^0.7.1",
|
||||||
"tailwindcss": "^3.2.0",
|
"tailwindcss": "^3.2.0",
|
||||||
"type-fest": "^4.18.2",
|
"type-fest": "^5.1.0",
|
||||||
"typescript": "^4.9.4",
|
"typescript": "^5.9.3",
|
||||||
"vitest": "^3.2.4"
|
"vitest": "^3.2.4"
|
||||||
},
|
},
|
||||||
"ct3aMetadata": {
|
"ct3aMetadata": {
|
||||||
|
|||||||
6174
pnpm-lock.yaml
generated
6174
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
|||||||
import type { FunctionComponent, ReactFragment, ReactNode } from "react";
|
import type { FunctionComponent, ReactNode } from "react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
type PropertyProps = {
|
type PropertyProps = {
|
||||||
title: string | ReactNode | ReactFragment;
|
title: string | ReactNode;
|
||||||
children: string | ReactNode | ReactFragment;
|
children: string | ReactNode;
|
||||||
titleClass?: string;
|
titleClass?: string;
|
||||||
valueClass?: string;
|
valueClass?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ export function ipv6InCIDR(ip: string, cidr: string): boolean {
|
|||||||
const mask = (maxMask << BigInt(128 - prefixLen)) & maxMask;
|
const mask = (maxMask << BigInt(128 - prefixLen)) & maxMask;
|
||||||
|
|
||||||
return (ipInt & mask) === (rangeInt & mask);
|
return (ipInt & mask) === (rangeInt & mask);
|
||||||
} catch (e) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ const useLookup = (warningHandler?: WarningHandler) => {
|
|||||||
|
|
||||||
async function getAndParse<T>(
|
async function getAndParse<T>(
|
||||||
url: string,
|
url: string,
|
||||||
schema: ZodSchema
|
schema: ZodSchema<T>
|
||||||
): Promise<Result<T, Error>> {
|
): Promise<Result<T, Error>> {
|
||||||
const response = await fetch(url);
|
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();
|
const data = await response.json();
|
||||||
|
|
||||||
// Try each schema until one works
|
// Try each schema until one works
|
||||||
@@ -381,7 +380,6 @@ const useLookup = (warningHandler?: WarningHandler) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
case "json": {
|
case "json": {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
||||||
const data = JSON.parse(target);
|
const data = JSON.parse(target);
|
||||||
for (const schema of schemas) {
|
for (const schema of schemas) {
|
||||||
const result = schema.safeParse(data);
|
const result = schema.safeParse(data);
|
||||||
|
|||||||
@@ -796,7 +796,7 @@ const TypeValidators = new Map<
|
|||||||
const octet = parseInt(octets[i] ?? "", 10);
|
const octet = parseInt(octets[i] ?? "", 10);
|
||||||
if (isNaN(octet) || octet < 0 || octet > 255) {
|
if (isNaN(octet) || octet < 0 || octet > 255) {
|
||||||
return Promise.resolve(
|
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`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user