upgrade Nodemailer to v10

fix dead code with knip

upgrade TS to v6 and fix linting errors

auto apply oxfmt rules

fix linting errors - unused deps etc

ignore file

remove all ignored files in knip

add knip - dead code analysis tool

swap prettier and eslint of oxfmt and oxlint

fix: fix map rendering in react strict mode

fix: headlessUI float replace

fix: disable Matomo if not URL and SITE ID exist

upgrade: 1st pass upgrade to Next.js v16

deps: upgrade react to v19
This commit is contained in:
2026-10-05 16:15:25 +02:00
committed by owenrees
parent df3a73df88
commit feadb465eb
122 changed files with 39491 additions and 32785 deletions
+23 -33
View File
@@ -5,51 +5,41 @@ export default function atomWithDebounce<T>(
delayMilliseconds = 500,
delayOnResetMilliseconds = 500,
) {
const prevTimeoutAtom = atom<ReturnType<typeof setTimeout> | undefined>(
undefined,
);
const prevTimeoutAtom = atom<ReturnType<typeof setTimeout> | undefined>(undefined);
// DO NOT EXPORT currentValueAtom as using this atom to set state can cause
// inconsistent state between currentValueAtom and debouncedValueAtom
const _currentValueAtom = atom(initialValue);
const isDebouncingAtom = atom(false);
const debouncedValueAtom = atom(
initialValue,
(get, set, update: SetStateAction<T>) => {
clearTimeout(get(prevTimeoutAtom));
const debouncedValueAtom = atom(initialValue, (get, set, update: SetStateAction<T>) => {
clearTimeout(get(prevTimeoutAtom));
const prevValue = get(_currentValueAtom);
const nextValue =
typeof update === "function"
? (update as (prev: T) => T)(prevValue)
: update;
const prevValue = get(_currentValueAtom);
const nextValue = typeof update === "function" ? (update as (prev: T) => T)(prevValue) : update;
const onDebounceStart = () => {
set(_currentValueAtom, nextValue);
set(isDebouncingAtom, true);
};
const onDebounceStart = () => {
set(_currentValueAtom, nextValue);
set(isDebouncingAtom, true);
};
const onDebounceEnd = () => {
set(debouncedValueAtom, nextValue);
set(isDebouncingAtom, false);
};
const onDebounceEnd = () => {
set(debouncedValueAtom, nextValue);
set(isDebouncingAtom, false);
};
onDebounceStart();
onDebounceStart();
const nextTimeoutId = setTimeout(
() => {
onDebounceEnd();
},
nextValue === initialValue
? delayOnResetMilliseconds
: delayMilliseconds,
);
const nextTimeoutId = setTimeout(
() => {
onDebounceEnd();
},
nextValue === initialValue ? delayOnResetMilliseconds : delayMilliseconds,
);
// set previous timeout atom in case it needs to get cleared
set(prevTimeoutAtom, nextTimeoutId);
},
);
// set previous timeout atom in case it needs to get cleared
set(prevTimeoutAtom, nextTimeoutId);
});
// exported atom setter to clear timeout if needed
const clearTimeoutAtom = atom(null, (get, set) => {
+1 -5
View File
@@ -21,11 +21,7 @@ export const filterClubsByManualEntry = (clubData: IClub[]): IClub[] =>
const existing = acc[key];
if (
club.manual_entry === true &&
existing.manual_entry !== true &&
club.pending !== true
) {
if (club.manual_entry === true && existing.manual_entry !== true && club.pending !== true) {
acc[key] = club;
}
+3 -11
View File
@@ -3,11 +3,7 @@ import { clamp, last } from "lodash";
// Fide uses the following table to establish the chance of winning based on the difference in elo.
// https://handbook.fide.com/chapter/B022017
const differenceToProbability: [
start: number,
end: number,
winChance: number,
][] = [
const differenceToProbability: [start: number, end: number, winChance: number][] = [
[0, 3, 0.5],
[4, 10, 0.51],
[11, 17, 0.52],
@@ -69,15 +65,11 @@ export const getNewRating = (
) => {
const differenceInElo = clamp(opponentRating - rating, -400, Infinity);
const tableRow = (differenceToProbability.find(
([start, end]) =>
Math.abs(differenceInElo) >= start && Math.abs(differenceInElo) <= end,
([start, end]) => Math.abs(differenceInElo) >= start && Math.abs(differenceInElo) <= end,
) ?? last(differenceToProbability)!)[2];
const probabilityOfWinning = differenceInElo < 0 ? tableRow : 1 - tableRow;
const delta =
Math.round(
kFactor * (result - probabilityOfWinning + Number.EPSILON) * 100,
) / 100;
const delta = Math.round(kFactor * (result - probabilityOfWinning + Number.EPSILON) * 100) / 100;
return {
delta,
-10
View File
@@ -1,10 +0,0 @@
const formatDate = (inputDate: any) => {
// TODO fix type
const date = new Date(inputDate);
const day = String(date.getDate()).padStart(2, "0");
const month = String(date.getMonth() + 1).padStart(2, "0");
const year = date.getFullYear();
return `${day}/${month}/${year}`;
};
export default formatDate;
+3 -3
View File
@@ -1,6 +1,6 @@
export const infoLog = (...params: any[]) => {
console.log(...params);
};
// export const infoLog = (...params: any[]) => {
// console.log(...params);
// };
export const errorLog = (...params: any[]) => {
console.error(...params);
+11 -17
View File
@@ -1,18 +1,17 @@
import { AuthError } from "next-auth";
import { EmailConfig } from "next-auth/providers/email";
import { getTranslations } from "next-intl/server";
import { createTransport } from "nodemailer";
import type { Transport, TransportOptions } from "nodemailer";
import * as JSONTransport from "nodemailer/lib/json-transport/index.js";
import * as SendmailTransport from "nodemailer/lib/sendmail-transport/index.js";
import * as SESTransport from "nodemailer/lib/ses-transport/index.js";
import * as SMTPPool from "nodemailer/lib/smtp-pool/index.js";
import * as SMTPTransport from "nodemailer/lib/smtp-transport/index.js";
import * as StreamTransport from "nodemailer/lib/stream-transport/index.js";
import SMTPTransport from "nodemailer/lib/smtp-transport";
import SMTPPool from "nodemailer/lib/smtp-pool";
import SendmailTransport from "nodemailer/lib/sendmail-transport";
import StreamTransport from "nodemailer/lib/stream-transport";
import JSONTransport from "nodemailer/lib/json-transport";
import SESTransport from "nodemailer/lib/ses-transport";
type Awaitable<T> = T | PromiseLike<T>;
export function html(params: {
function html(params: {
url: string;
host: string;
t: Awaited<ReturnType<typeof getTranslations<"SignIn">>>;
@@ -44,7 +43,7 @@ export function html(params: {
</td>
</tr>
<tr>
<td align="center" style="padding: 20px 0;">
<td align="center" style="padding: 20px 0px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 5px;" bgcolor="${color.buttonBackground}">
@@ -70,7 +69,7 @@ export function html(params: {
}
/** Email Text body (fallback for email clients that don't render HTML, e.g. feature phones) */
export function text({
function text({
url,
host,
t,
@@ -113,14 +112,9 @@ export interface NodemailerConfig extends EmailConfig {
options?: NodemailerUserConfig;
}
export type NodemailerUserConfig = Omit<
Partial<NodemailerConfig>,
"options" | "type"
>;
export type NodemailerUserConfig = Omit<Partial<NodemailerConfig>, "options" | "type">;
export default function Nodemailer(
config: NodemailerUserConfig,
): NodemailerConfig {
export default function Nodemailer(config: NodemailerUserConfig): NodemailerConfig {
return {
id: "nodemailer",
type: "email",
+3 -19
View File
@@ -20,19 +20,7 @@ function getDAttribute(radius: number, startAngle: number, endAngle: number) {
const end = polarToCartesian(radius, endAngle);
const largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1;
const d = [
"M",
start.x,
start.y,
"A",
radius,
radius,
0,
largeArcFlag,
1,
end.x,
end.y,
];
const d = ["M", start.x, start.y, "A", radius, radius, 0, largeArcFlag, 1, end.x, end.y];
if (isCircle) {
d.push("Z");
@@ -55,11 +43,7 @@ type PieSlice = {
colour: string;
};
export function generatePieSVG(
className: string,
radius: number,
values: PieSlice[],
) {
export function generatePieSVG(className: string, radius: number, values: PieSlice[]) {
type Sector = {
colour: string;
degrees: number;
@@ -80,5 +64,5 @@ export function generatePieSVG(
return [...prev, [to, path(getDAttribute(radius, from, to), value.colour)]];
}, []);
return svg(className, radius * 2, paths.map(([to, path]) => path).join(""));
return svg(className, radius * 2, paths.map(([_to, path]) => path).join(""));
}
+2 -3
View File
@@ -1,4 +1,4 @@
import { createLocalizedPathnamesNavigation } from "next-intl/navigation";
import { createNavigation } from "next-intl/navigation";
import { defineRouting } from "next-intl/routing";
export const routing = defineRouting({
@@ -61,5 +61,4 @@ export const routing = defineRouting({
export type Pathnames = keyof typeof routing.pathnames;
export type Locale = (typeof routing.locales)[number];
export const { Link, redirect, usePathname, useRouter, getPathname } =
createLocalizedPathnamesNavigation(routing);
export const { Link, usePathname, useRouter, getPathname } = createNavigation(routing);
-8
View File
@@ -1,8 +0,0 @@
import { ScrollableElement } from "@/types";
const isBrowser = () => typeof window !== "undefined";
export const handleScrollToTop = (element: ScrollableElement | null) => {
if (!isBrowser()) return;
element?.scrollTo({ top: 0, behavior: "smooth" });
};