Skip to content

A suite of dependency upgrades #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/.storybook/I18nStoryWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { defaultLocale, formats, timeZone } from "../src/i18n/config";

const I18nStoryWrapper = (
Story: React.ComponentType,
context: StoryContext
context: StoryContext,
) => {
const locale = context.globals.locale ?? defaultLocale;

Expand Down
22,533 changes: 5,244 additions & 17,289 deletions app/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@trussworks/react-uswds": "^9.0.0",
"@uswds/uswds": "3.8.1",
"lodash": "^4.17.21",
"next": "^14.0.3",
"next": "^15.1.1",
"next-intl": "^3.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -44,13 +44,13 @@
"@types/jest": "^29.5.5",
"@types/jest-axe": "^3.5.5",
"@types/lodash": "^4.14.202",
"@types/node": "^20.0.0",
"@types/node": "^22.10.2",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^8.36.0",
"eslint-config-next": "^14.0.0",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"eslint": "^9.0.0",
"eslint-config-next": "^15.1.1",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^28.0.0",
"eslint-plugin-jest-dom": "^5.0.1",
Expand All @@ -64,10 +64,10 @@
"postcss": "^8.4.31",
"postcss-loader": "^8.0.0",
"postcss-preset-env": "^10.0.0",
"prettier": "^2.8.4",
"prettier": "^3.4.2",
"sass": "^1.59.3",
"sass-loader": "^16.0.0",
"storybook": "^8.0.0",
"storybook": "^8.4.7",
"style-loader": "^4.0.0",
"typescript": "^5.0.0"
}
Expand Down
11 changes: 5 additions & 6 deletions app/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ export const metadata: Metadata = {

interface LayoutProps {
children: React.ReactNode;
params: {
locale: string;
};
params: Promise<{ locale: string }>;
}

export default function RootLayout({ children, params }: LayoutProps) {
export default async function RootLayout({ children, params }: LayoutProps) {
const { locale } = await params;
return (
<html lang={params.locale}>
<html lang={locale}>
<body>
{/* Separate layout component for the inner-body UI elements since Storybook
and tests trip over the fact that this file renders an <html> tag */}
<Layout locale={params.locale}>{children}</Layout>
<Layout locale={locale}>{children}</Layout>
</body>
</html>
);
Expand Down
13 changes: 7 additions & 6 deletions app/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { getTranslations } from "next-intl/server";

import { View } from "./view";

interface RouteParams {
locale: string;
}

export async function generateMetadata({ params }: { params: RouteParams }) {
const t = await getTranslations({ locale: params.locale });
export async function generateMetadata({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
const t = await getTranslations({ locale });
const meta: Metadata = {
title: t("home.title"),
};
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/Layout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Layout", () => {
render(
<Layout locale="en-US">
<h1>child</h1>
</Layout>
</Layout>,
);

const header = screen.getByRole("heading", { name: /child/i, level: 1 });
Expand All @@ -20,7 +20,7 @@ describe("Layout", () => {
const { container } = render(
<Layout locale="en-US">
<h1>child</h1>
</Layout>
</Layout>,
);
const results = await axe(container);

Expand Down
4 changes: 2 additions & 2 deletions app/src/i18n/getMessagesWithFallbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ async function importMessages(locale: Locale) {
* from the current locale, the missing key will fallback to the default locale
*/
export async function getMessagesWithFallbacks(
requestedLocale: string = defaultLocale
requestedLocale: string = defaultLocale,
) {
const isValidLocale = locales.includes(requestedLocale as Locale); // https://github.com/microsoft/TypeScript/issues/26255
if (!isValidLocale) {
console.error(
"Unsupported locale was requested. Falling back to the default locale.",
{ locale: requestedLocale, defaultLocale }
{ locale: requestedLocale, defaultLocale },
);
requestedLocale = defaultLocale;
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/i18n/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { getMessagesWithFallbacks } from "./getMessagesWithFallbacks";
* This method is used behind the scenes by `next-intl/plugin`, which is setup in next.config.js.
* @see https://next-intl-docs.vercel.app/docs/usage/configuration#nextconfigjs
*/
export default getRequestConfig(async ({ locale }) => {
export default getRequestConfig(async ({ requestLocale }) => {
const locale = await requestLocale;
return {
formats,
messages: await getMessagesWithFallbacks(locale),
Expand Down
2 changes: 1 addition & 1 deletion app/tests/react-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export * from "@testing-library/react";
// 2. Then override the "@testing-library/react" render method
export function render(
ui: React.ReactElement,
options: Omit<RenderOptions, "wrapper"> = {}
options: Omit<RenderOptions, "wrapper"> = {},
) {
return _render(ui, { wrapper: GlobalProviders, ...options });
}
Loading