Skip to content

Commit 2fd54c5

Browse files
authored
A suite of dependency upgrades (#376)
## Ticket Resolves #{TICKET NUMBER OR URL} N/A ## Changes - Upgrade next.js to 15 (Requires us to await params): https://nextjs.org/docs/messages/sync-dynamic-apis - Upgrade eslint to 9 - A few addl upgrades - npm audit ## Context for reviewers Working through the separate dependabot PRs was a bit slow ## Testing Clean run locally: <img width="1470" alt="Screenshot 2024-12-17 at 3 18 09 PM" src="https://github.com/user-attachments/assets/227e09dc-7fd9-4dba-a2f9-1ad3928b7f63" />
1 parent d50eaad commit 2fd54c5

File tree

9 files changed

+5272
-17316
lines changed

9 files changed

+5272
-17316
lines changed

app/.storybook/I18nStoryWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { defaultLocale, formats, timeZone } from "../src/i18n/config";
1111

1212
const I18nStoryWrapper = (
1313
Story: React.ComponentType,
14-
context: StoryContext
14+
context: StoryContext,
1515
) => {
1616
const locale = context.globals.locale ?? defaultLocale;
1717

app/package-lock.json

Lines changed: 5244 additions & 17289 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@trussworks/react-uswds": "^9.0.0",
2727
"@uswds/uswds": "3.8.1",
2828
"lodash": "^4.17.21",
29-
"next": "^14.0.3",
29+
"next": "^15.1.1",
3030
"next-intl": "^3.2.1",
3131
"react": "^18.2.0",
3232
"react-dom": "^18.2.0",
@@ -44,13 +44,13 @@
4444
"@types/jest": "^29.5.5",
4545
"@types/jest-axe": "^3.5.5",
4646
"@types/lodash": "^4.14.202",
47-
"@types/node": "^20.0.0",
47+
"@types/node": "^22.10.2",
4848
"@types/react": "^18.2.42",
4949
"@types/react-dom": "^18.2.17",
50-
"@typescript-eslint/eslint-plugin": "^8.0.0",
51-
"@typescript-eslint/parser": "^8.0.0",
52-
"eslint": "^8.36.0",
53-
"eslint-config-next": "^14.0.0",
50+
"@typescript-eslint/eslint-plugin": "^8.18.1",
51+
"@typescript-eslint/parser": "^8.18.1",
52+
"eslint": "^9.0.0",
53+
"eslint-config-next": "^15.1.1",
5454
"eslint-config-prettier": "^9.0.0",
5555
"eslint-plugin-jest": "^28.0.0",
5656
"eslint-plugin-jest-dom": "^5.0.1",
@@ -64,10 +64,10 @@
6464
"postcss": "^8.4.31",
6565
"postcss-loader": "^8.0.0",
6666
"postcss-preset-env": "^10.0.0",
67-
"prettier": "^2.8.4",
67+
"prettier": "^3.4.2",
6868
"sass": "^1.59.3",
6969
"sass-loader": "^16.0.0",
70-
"storybook": "^8.0.0",
70+
"storybook": "^8.4.7",
7171
"style-loader": "^4.0.0",
7272
"typescript": "^5.0.0"
7373
}

app/src/app/[locale]/layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@ export const metadata: Metadata = {
1414

1515
interface LayoutProps {
1616
children: React.ReactNode;
17-
params: {
18-
locale: string;
19-
};
17+
params: Promise<{ locale: string }>;
2018
}
2119

22-
export default function RootLayout({ children, params }: LayoutProps) {
20+
export default async function RootLayout({ children, params }: LayoutProps) {
21+
const { locale } = await params;
2322
return (
24-
<html lang={params.locale}>
23+
<html lang={locale}>
2524
<body>
2625
{/* Separate layout component for the inner-body UI elements since Storybook
2726
and tests trip over the fact that this file renders an <html> tag */}
28-
<Layout locale={params.locale}>{children}</Layout>
27+
<Layout locale={locale}>{children}</Layout>
2928
</body>
3029
</html>
3130
);

app/src/app/[locale]/page.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { getTranslations } from "next-intl/server";
44

55
import { View } from "./view";
66

7-
interface RouteParams {
8-
locale: string;
9-
}
10-
11-
export async function generateMetadata({ params }: { params: RouteParams }) {
12-
const t = await getTranslations({ locale: params.locale });
7+
export async function generateMetadata({
8+
params,
9+
}: {
10+
params: Promise<{ locale: string }>;
11+
}) {
12+
const { locale } = await params;
13+
const t = await getTranslations({ locale });
1314
const meta: Metadata = {
1415
title: t("home.title"),
1516
};

app/src/components/Layout.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("Layout", () => {
88
render(
99
<Layout locale="en-US">
1010
<h1>child</h1>
11-
</Layout>
11+
</Layout>,
1212
);
1313

1414
const header = screen.getByRole("heading", { name: /child/i, level: 1 });
@@ -20,7 +20,7 @@ describe("Layout", () => {
2020
const { container } = render(
2121
<Layout locale="en-US">
2222
<h1>child</h1>
23-
</Layout>
23+
</Layout>,
2424
);
2525
const results = await axe(container);
2626

app/src/i18n/getMessagesWithFallbacks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ async function importMessages(locale: Locale) {
1515
* from the current locale, the missing key will fallback to the default locale
1616
*/
1717
export async function getMessagesWithFallbacks(
18-
requestedLocale: string = defaultLocale
18+
requestedLocale: string = defaultLocale,
1919
) {
2020
const isValidLocale = locales.includes(requestedLocale as Locale); // https://github.com/microsoft/TypeScript/issues/26255
2121
if (!isValidLocale) {
2222
console.error(
2323
"Unsupported locale was requested. Falling back to the default locale.",
24-
{ locale: requestedLocale, defaultLocale }
24+
{ locale: requestedLocale, defaultLocale },
2525
);
2626
requestedLocale = defaultLocale;
2727
}

app/src/i18n/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { getMessagesWithFallbacks } from "./getMessagesWithFallbacks";
88
* This method is used behind the scenes by `next-intl/plugin`, which is setup in next.config.js.
99
* @see https://next-intl-docs.vercel.app/docs/usage/configuration#nextconfigjs
1010
*/
11-
export default getRequestConfig(async ({ locale }) => {
11+
export default getRequestConfig(async ({ requestLocale }) => {
12+
const locale = await requestLocale;
1213
return {
1314
formats,
1415
messages: await getMessagesWithFallbacks(locale),

app/tests/react-utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export * from "@testing-library/react";
3333
// 2. Then override the "@testing-library/react" render method
3434
export function render(
3535
ui: React.ReactElement,
36-
options: Omit<RenderOptions, "wrapper"> = {}
36+
options: Omit<RenderOptions, "wrapper"> = {},
3737
) {
3838
return _render(ui, { wrapper: GlobalProviders, ...options });
3939
}

0 commit comments

Comments
 (0)