diff --git a/package-lock.json b/package-lock.json index 6940b813..390375aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5129,15 +5129,15 @@ "license": "MIT" }, "node_modules/@next/env": { - "version": "15.5.10", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.10.tgz", - "integrity": "sha512-plg+9A/KoZcTS26fe15LHg+QxReTazrIOoKKUC3Uz4leGGeNPgLHdevVraAAOX0snnUs3WkRx3eUQpj9mreG6A==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.6.tgz", + "integrity": "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { - "version": "15.5.12", - "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-15.5.12.tgz", - "integrity": "sha512-+ZRSDFTv4aC96aMb5E41rMjysx8ApkryevnvEYZvPZO52KvkqP5rNExLUXJFr9P4s0f3oqNQR6vopCZsPWKDcQ==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.1.6.tgz", + "integrity": "sha512-/Qq3PTagA6+nYVfryAtQ7/9FEr/6YVyvOtl6rZnGsbReGLf0jZU6gkpr1FuChAQpvV46a78p4cmHOVP8mbfSMQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5145,9 +5145,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.5.7.tgz", - "integrity": "sha512-IZwtxCEpI91HVU/rAUOOobWSZv4P2DeTtNaCdHqLcTJU4wdNXgAySvKa/qJCgR5m6KI8UsKDXtO2B31jcaw1Yw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.1.6.tgz", + "integrity": "sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw==", "cpu": [ "arm64" ], @@ -5161,9 +5161,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.5.7.tgz", - "integrity": "sha512-UP6CaDBcqaCBuiq/gfCEJw7sPEoX1aIjZHnBWN9v9qYHQdMKvCKcAVs4OX1vIjeE+tC5EIuwDTVIoXpUes29lg==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.1.6.tgz", + "integrity": "sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ==", "cpu": [ "x64" ], @@ -5177,9 +5177,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.5.7.tgz", - "integrity": "sha512-NCslw3GrNIw7OgmRBxHtdWFQYhexoUCq+0oS2ccjyYLtcn1SzGzeM54jpTFonIMUjNbHmpKpziXnpxhSWLcmBA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.1.6.tgz", + "integrity": "sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw==", "cpu": [ "arm64" ], @@ -5193,9 +5193,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.5.7.tgz", - "integrity": "sha512-nfymt+SE5cvtTrG9u1wdoxBr9bVB7mtKTcj0ltRn6gkP/2Nu1zM5ei8rwP9qKQP0Y//umK+TtkKgNtfboBxRrw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.1.6.tgz", + "integrity": "sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ==", "cpu": [ "arm64" ], @@ -5209,9 +5209,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.5.7.tgz", - "integrity": "sha512-hvXcZvCaaEbCZcVzcY7E1uXN9xWZfFvkNHwbe/n4OkRhFWrs1J1QV+4U1BN06tXLdaS4DazEGXwgqnu/VMcmqw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.1.6.tgz", + "integrity": "sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ==", "cpu": [ "x64" ], @@ -5225,9 +5225,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.5.7.tgz", - "integrity": "sha512-4IUO539b8FmF0odY6/SqANJdgwn1xs1GkPO5doZugwZ3ETF6JUdckk7RGmsfSf7ws8Qb2YB5It33mvNL/0acqA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.1.6.tgz", + "integrity": "sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg==", "cpu": [ "x64" ], @@ -5241,9 +5241,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.5.7.tgz", - "integrity": "sha512-CpJVTkYI3ZajQkC5vajM7/ApKJUOlm6uP4BknM3XKvJ7VXAvCqSjSLmM0LKdYzn6nBJVSjdclx8nYJSa3xlTgQ==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.1.6.tgz", + "integrity": "sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw==", "cpu": [ "arm64" ], @@ -5257,9 +5257,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.5.7.tgz", - "integrity": "sha512-gMzgBX164I6DN+9/PGA+9dQiwmTkE4TloBNx8Kv9UiGARsr9Nba7IpcBRA1iTV9vwlYnrE3Uy6I7Aj6qLjQuqw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.1.6.tgz", + "integrity": "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A==", "cpu": [ "x64" ], @@ -5785,13 +5785,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@rushstack/eslint-patch": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.16.1.tgz", - "integrity": "sha512-TvZbIpeKqGQQ7X0zSCvPH9riMSFQFSggnfBjFZ1mEoILW+UuXCKwOoPcgjMwiUtRqFZ8jWhPJc4um14vC6I4ag==", - "dev": true, - "license": "MIT" - }, "node_modules/@rushstack/node-core-library": { "version": "5.20.1", "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.20.1.tgz", @@ -11718,25 +11711,24 @@ } }, "node_modules/eslint-config-next": { - "version": "15.5.12", - "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-15.5.12.tgz", - "integrity": "sha512-ktW3XLfd+ztEltY5scJNjxjHwtKWk6vU2iwzZqSN09UsbBmMeE/cVlJ1yESg6Yx5LW7p/Z8WzUAgYXGLEmGIpg==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.1.6.tgz", + "integrity": "sha512-vKq40io2B0XtkkNDYyleATwblNt8xuh3FWp8SpSz3pt7P01OkBFlKsJZ2mWt5WsCySlDQLckb1zMY9yE9Qy0LA==", "dev": true, "license": "MIT", "dependencies": { - "@next/eslint-plugin-next": "15.5.12", - "@rushstack/eslint-patch": "^1.10.3", - "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", - "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", + "@next/eslint-plugin-next": "16.1.6", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", - "eslint-plugin-import": "^2.31.0", + "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", - "eslint-plugin-react-hooks": "^5.0.0" + "eslint-plugin-react-hooks": "^7.0.0", + "globals": "16.4.0", + "typescript-eslint": "^8.46.0" }, "peerDependencies": { - "eslint": "^7.23.0 || ^8.0.0 || ^9.0.0", + "eslint": ">=9.0.0", "typescript": ">=3.3.1" }, "peerDependenciesMeta": { @@ -11745,17 +11737,17 @@ } } }, - "node_modules/eslint-config-next/node_modules/eslint-plugin-react-hooks": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz", - "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==", + "node_modules/eslint-config-next/node_modules/globals": { + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz", + "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==", "dev": true, "license": "MIT", "engines": { - "node": ">=10" + "node": ">=18" }, - "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint-config-prettier": { @@ -17085,13 +17077,14 @@ "license": "MIT" }, "node_modules/next": { - "version": "15.5.10", - "resolved": "https://registry.npmjs.org/next/-/next-15.5.10.tgz", - "integrity": "sha512-r0X65PNwyDDyOrWNKpQoZvOatw7BcsTPRKdwEqtc9cj3wv7mbBIk9tKed4klRaFXJdX0rugpuMTHslDrAU1bBg==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/next/-/next-16.1.6.tgz", + "integrity": "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==", "license": "MIT", "dependencies": { - "@next/env": "15.5.10", + "@next/env": "16.1.6", "@swc/helpers": "0.5.15", + "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" @@ -17100,18 +17093,18 @@ "next": "dist/bin/next" }, "engines": { - "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" + "node": ">=20.9.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "15.5.7", - "@next/swc-darwin-x64": "15.5.7", - "@next/swc-linux-arm64-gnu": "15.5.7", - "@next/swc-linux-arm64-musl": "15.5.7", - "@next/swc-linux-x64-gnu": "15.5.7", - "@next/swc-linux-x64-musl": "15.5.7", - "@next/swc-win32-arm64-msvc": "15.5.7", - "@next/swc-win32-x64-msvc": "15.5.7", - "sharp": "^0.34.3" + "@next/swc-darwin-arm64": "16.1.6", + "@next/swc-darwin-x64": "16.1.6", + "@next/swc-linux-arm64-gnu": "16.1.6", + "@next/swc-linux-arm64-musl": "16.1.6", + "@next/swc-linux-x64-gnu": "16.1.6", + "@next/swc-linux-x64-musl": "16.1.6", + "@next/swc-win32-arm64-msvc": "16.1.6", + "@next/swc-win32-x64-msvc": "16.1.6", + "sharp": "^0.34.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -21255,6 +21248,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.56.0.tgz", + "integrity": "sha512-c7toRLrotJ9oixgdW7liukZpsnq5CZ7PuKztubGYlNppuTqhIoWfhgHo/7EU0v06gS2l/x0i2NEFK1qMIf0rIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.56.0", + "@typescript-eslint/parser": "8.56.0", + "@typescript-eslint/typescript-estree": "8.56.0", + "@typescript-eslint/utils": "8.56.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, "node_modules/ufo": { "version": "1.6.3", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", @@ -22218,7 +22235,7 @@ "@types/react": "19.2.14", "@types/react-dom": "19.2.3", "autoprefixer": "10.4.24", - "next": "15.5.10", + "next": "16.1.6", "postcss": "8.5.6", "react": "^19.0.0", "react-dom": "^19.0.0", @@ -22234,7 +22251,7 @@ "@typescript-eslint/parser": "^8.31.0", "cypress": "^15.0.0", "eslint": "^9.14.0", - "eslint-config-next": "^15.0.2", + "eslint-config-next": "^16.0.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-unused-imports": "^4.1.4", @@ -22355,7 +22372,7 @@ "@mui/x-date-pickers": "^8.0.0", "@tanstack/react-table": "^8.20.5", "autoprefixer": "10.4.24", - "next": "15.5.10", + "next": "16.1.6", "postcss": "8.5.6", "react": "^19.0.0", "react-dom": "^19.0.0" @@ -22369,8 +22386,9 @@ "@types/react-dom": "^19.0.0", "cypress": "^15.0.0", "eslint": "^9", - "eslint-config-next": "15.5.12", + "eslint-config-next": "16.1.6", "eslint-config-prettier": "^10.0.1", + "eslint-plugin-unused-imports": "^4.1.4", "lint-staged": "^16.0.0", "prettier": "^3.2.5", "typescript": "^5" diff --git a/packages/diracx-web-components/src/components/shared/Sunburst/Sunburst.tsx b/packages/diracx-web-components/src/components/shared/Sunburst/Sunburst.tsx index 671afa8a..fdb5e239 100644 --- a/packages/diracx-web-components/src/components/shared/Sunburst/Sunburst.tsx +++ b/packages/diracx-web-components/src/components/shared/Sunburst/Sunburst.tsx @@ -1,4 +1,4 @@ -import React, { MouseEvent, useEffect, useRef, useMemo } from "react"; +import React, { MouseEvent, useEffect, useRef } from "react"; import { HierarchyNode, @@ -59,15 +59,15 @@ export function Sunburst({ isLoading = false, error = null, }: SunburstProps) { - // Create a stable default color scale with useMemo - const defaultColorScale = useMemo(() => { + // Create a default color scale + const defaultColorScale = (() => { if (!tree?.children) return () => "#ccc"; const colorScale = scaleOrdinal( quantize(interpolateRainbow, tree.children.length + 1), ); return (name: string, _size: number, _depth: number) => colorScale(name); - }, [tree.children]); + })(); // Use the provided colorScales or the default one const finalColorScales = colorScales || defaultColorScale; @@ -196,18 +196,8 @@ export function Sunburst({ // Make them interact with the mouse path - .on( - "mouseover", - function (this: SVGPathElement, event: MouseEvent, p: SunburstNode) { - mouseOn.call(this, event, p); - }, - ) - .on( - "mouseout", - function (this: SVGPathElement, event: MouseEvent, p: SunburstNode) { - mouseOut.call(this, event, p); - }, - ) + .on("mouseover", mouseOn) + .on("mouseout", mouseOut) .on("mousemove", mouseMove) .on("contextmenu", rightClicked); @@ -260,13 +250,10 @@ export function Sunburst({ return `rotate(${x - 90}) translate(${y},0) rotate(${x < 180 ? 0 : 180})`; } - function mouseOn( - this: SVGPathElement | null, - event: MouseEvent, - p: SunburstNode, - ) { + function mouseOn(event: MouseEvent, p: SunburstNode) { + const element = event.currentTarget as SVGPathElement; if (p.children && setCurrentPath) { - select(this).transition().duration(30).attr("opacity", "0.85"); + select(element).transition().duration(30).attr("opacity", "0.85"); } tooltip.style("visibility", "visible"); tooltip @@ -279,12 +266,9 @@ export function Sunburst({ ); } - function mouseOut( - this: SVGPathElement, - _event: MouseEvent, - _p: SunburstNode, - ) { - select(this).transition().duration(30).attr("opacity", "1"); + function mouseOut(_event: MouseEvent, _p: SunburstNode) { + const element = _event.currentTarget as SVGPathElement; + select(element).transition().duration(30).attr("opacity", "1"); tooltip.style("visibility", "hidden"); } diff --git a/packages/diracx-web/eslint.config.js b/packages/diracx-web/eslint.config.js index 6be6693d..77a5c99d 100644 --- a/packages/diracx-web/eslint.config.js +++ b/packages/diracx-web/eslint.config.js @@ -1,11 +1,9 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; -import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; -import _import from "eslint-plugin-import"; +import { fixupConfigRules } from "@eslint/compat"; import js from "@eslint/js"; import { FlatCompat } from "@eslint/eslintrc"; -import tsPlugin from "@typescript-eslint/eslint-plugin"; -import tsParser from "@typescript-eslint/parser"; +import nextCoreWebVitals from "eslint-config-next/core-web-vitals"; import eslintPluginUnusedImports from "eslint-plugin-unused-imports"; const __filename = fileURLToPath(import.meta.url); @@ -18,23 +16,14 @@ const compat = new FlatCompat({ // This config is only for typescript files export default [ - ...fixupConfigRules( - compat.extends( - "next/core-web-vitals", - "prettier", - "plugin:import/recommended", - "plugin:import/typescript", - ), - ), + ...nextCoreWebVitals, + ...fixupConfigRules(compat.extends("prettier")), { plugins: { - import: fixupPluginRules(_import), - "@typescript-eslint": tsPlugin, "unused-imports": eslintPluginUnusedImports, }, languageOptions: { - parser: tsParser, globals: { JSX: "readonly", }, diff --git a/packages/diracx-web/next.config.js b/packages/diracx-web/next.config.js index f6ee364c..c762b2b7 100644 --- a/packages/diracx-web/next.config.js +++ b/packages/diracx-web/next.config.js @@ -5,6 +5,8 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); +const componentsSrc = path.resolve(__dirname, "../diracx-web-components/src"); + export default (phase) => { const isDev = phase === PHASE_DEVELOPMENT_SERVER; @@ -12,8 +14,19 @@ export default (phase) => { transpilePackages: ["@dirac-grid/diracx-web-components"], ...(isDev && { webpack: (config) => { + // In dev mode, resolve diracx-web-components imports to source + // files for HMR. Each subpath must be aliased explicitly because + // webpack 5 resolves package exports before resolve.alias. + config.resolve.alias["@dirac-grid/diracx-web-components/components"] = + path.join(componentsSrc, "components"); + config.resolve.alias["@dirac-grid/diracx-web-components/contexts"] = + path.join(componentsSrc, "contexts"); + config.resolve.alias["@dirac-grid/diracx-web-components/hooks"] = + path.join(componentsSrc, "hooks"); + config.resolve.alias["@dirac-grid/diracx-web-components/types"] = + path.join(componentsSrc, "types"); config.resolve.alias["@dirac-grid/diracx-web-components"] = - path.resolve(__dirname, "../diracx-web-components/src"); + componentsSrc; return config; }, }), diff --git a/packages/diracx-web/package.json b/packages/diracx-web/package.json index bc394bc6..b9d4f8e5 100644 --- a/packages/diracx-web/package.json +++ b/packages/diracx-web/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "scripts": { - "dev": "export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev", + "dev": "export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev --webpack", "build": "next build", "test": "cypress open --config baseUrl=$DIRACX_URL", "start": "next start", @@ -24,7 +24,7 @@ "@types/react": "19.2.14", "@types/react-dom": "19.2.3", "autoprefixer": "10.4.24", - "next": "15.5.10", + "next": "16.1.6", "postcss": "8.5.6", "react": "^19.0.0", "react-dom": "^19.0.0", @@ -40,7 +40,7 @@ "@typescript-eslint/parser": "^8.31.0", "cypress": "^15.0.0", "eslint": "^9.14.0", - "eslint-config-next": "^15.0.2", + "eslint-config-next": "^16.0.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-unused-imports": "^4.1.4", diff --git a/packages/diracx-web/tsconfig.json b/packages/diracx-web/tsconfig.json index 6f57de34..a08c79f8 100644 --- a/packages/diracx-web/tsconfig.json +++ b/packages/diracx-web/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es6", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -12,7 +16,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "incremental": true, "plugins": [ { @@ -20,9 +24,22 @@ } ], "paths": { - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules", "test/*/*.ts", "test/*/*.tsx", "jest.setup.ts"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + ".next/dev/types/**/*.ts" + ], + "exclude": [ + "node_modules", + "test/*/*.ts", + "test/*/*.tsx", + "jest.setup.ts" + ] } diff --git a/packages/extensions/eslint.config.js b/packages/extensions/eslint.config.js index 65f88daa..77a5c99d 100644 --- a/packages/extensions/eslint.config.js +++ b/packages/extensions/eslint.config.js @@ -1,10 +1,9 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; -import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; -import _import from "eslint-plugin-import"; +import { fixupConfigRules } from "@eslint/compat"; import js from "@eslint/js"; import { FlatCompat } from "@eslint/eslintrc"; -import tsPlugin from "@typescript-eslint/eslint-plugin"; +import nextCoreWebVitals from "eslint-config-next/core-web-vitals"; import eslintPluginUnusedImports from "eslint-plugin-unused-imports"; const __filename = fileURLToPath(import.meta.url); @@ -17,18 +16,10 @@ const compat = new FlatCompat({ // This config is only for typescript files export default [ - ...fixupConfigRules( - compat.extends( - "next/core-web-vitals", - "prettier", - "plugin:import/recommended", - "plugin:import/typescript", - ), - ), + ...nextCoreWebVitals, + ...fixupConfigRules(compat.extends("prettier")), { plugins: { - import: fixupPluginRules(_import), - "@typescript-eslint": tsPlugin, "unused-imports": eslintPluginUnusedImports, }, diff --git a/packages/extensions/next.config.js b/packages/extensions/next.config.js index f6ee364c..c762b2b7 100644 --- a/packages/extensions/next.config.js +++ b/packages/extensions/next.config.js @@ -5,6 +5,8 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/constants.js"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); +const componentsSrc = path.resolve(__dirname, "../diracx-web-components/src"); + export default (phase) => { const isDev = phase === PHASE_DEVELOPMENT_SERVER; @@ -12,8 +14,19 @@ export default (phase) => { transpilePackages: ["@dirac-grid/diracx-web-components"], ...(isDev && { webpack: (config) => { + // In dev mode, resolve diracx-web-components imports to source + // files for HMR. Each subpath must be aliased explicitly because + // webpack 5 resolves package exports before resolve.alias. + config.resolve.alias["@dirac-grid/diracx-web-components/components"] = + path.join(componentsSrc, "components"); + config.resolve.alias["@dirac-grid/diracx-web-components/contexts"] = + path.join(componentsSrc, "contexts"); + config.resolve.alias["@dirac-grid/diracx-web-components/hooks"] = + path.join(componentsSrc, "hooks"); + config.resolve.alias["@dirac-grid/diracx-web-components/types"] = + path.join(componentsSrc, "types"); config.resolve.alias["@dirac-grid/diracx-web-components"] = - path.resolve(__dirname, "../diracx-web-components/src"); + componentsSrc; return config; }, }), diff --git a/packages/extensions/package.json b/packages/extensions/package.json index ca8cc0ce..882be530 100644 --- a/packages/extensions/package.json +++ b/packages/extensions/package.json @@ -5,7 +5,7 @@ "type": "module", "license": "GPL-3.0-only", "scripts": { - "dev": "export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev", + "dev": "export NEXT_PUBLIC_DIRACX_URL=$DIRACX_URL; next dev --webpack", "build": "next build", "test": "cypress open --config baseUrl=$DIRACX_URL", "start": "next start", @@ -23,7 +23,7 @@ "@mui/x-date-pickers": "^8.0.0", "@tanstack/react-table": "^8.20.5", "autoprefixer": "10.4.24", - "next": "15.5.10", + "next": "16.1.6", "postcss": "8.5.6", "react": "^19.0.0", "react-dom": "^19.0.0" @@ -37,8 +37,9 @@ "@types/react-dom": "^19.0.0", "cypress": "^15.0.0", "eslint": "^9", - "eslint-config-next": "15.5.12", + "eslint-config-next": "16.1.6", "eslint-config-prettier": "^10.0.1", + "eslint-plugin-unused-imports": "^4.1.4", "lint-staged": "^16.0.0", "prettier": "^3.2.5", "typescript": "^5"