Skip to content

Commit

Permalink
fix: adjust existing code to satisfy updated acdh-ch linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstadler committed Dec 16, 2024
1 parent 7087187 commit 20cf8cb
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/[locale]/(index)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations, unstable_setRequestLocale as setRequestLocale } from "next-intl/server";
import { getTranslations, setRequestLocale } from "next-intl/server";

import { MainContent } from "@/components/main-content";
import { PublicationGrid } from "@/components/publication-grid";
Expand Down Expand Up @@ -48,7 +48,7 @@ export default async function IndexPage(props: IndexPageProps) {
// TODO workaround until upgrade to typesense 0.28, afterwards can just use: "_rand:asc"
// just look for a single random letter a-w (ASCII 65-87)
q: String.fromCharCode(Math.floor(65 + 22 * Math.random())),
sort_by: "_text_match:" + (Math.random() > 0.5 ? "asc" : "desc"),
sort_by: `_text_match:${Math.random() > 0.5 ? "asc" : "desc"}`,
});
return (
<MainContent>
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/imprint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpError, request } from "@acdh-oeaw/lib";
import type { Metadata, ResolvingMetadata } from "next";
import { notFound } from "next/navigation";
import { useTranslations } from "next-intl";
import { getTranslations, unstable_setRequestLocale as setRequestLocale } from "next-intl/server";
import { getTranslations, setRequestLocale } from "next-intl/server";
import type { ReactNode } from "react";

import { MainContent } from "@/components/main-content";
Expand Down
1 change: 1 addition & 0 deletions app/[locale]/internal-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface InternalErrorProps {
}

/** `React.lazy` requires default export. */
// eslint-disable-next-line import-x/no-default-export
export default function InternalError(props: InternalErrorProps): ReactNode {
const { error, reset } = props;

Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { pick } from "@acdh-oeaw/lib";
import { cn } from "@acdh-oeaw/style-variants";
import type { Metadata, ResolvingMetadata } from "next";
import { useMessages, useTranslations } from "next-intl";
import { getTranslations, unstable_setRequestLocale as setRequestLocale } from "next-intl/server";
import { getTranslations, setRequestLocale } from "next-intl/server";
import type { ReactNode } from "react";
import { LocalizedStringProvider as Translations } from "react-aria-components/i18n";
import { jsonLdScriptProps } from "react-schemaorg";
Expand Down
1 change: 1 addition & 0 deletions components/disclosure-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function DisclosureButton(props: DisclosureButtonProps): ReactNode {
aria-expanded={props.state}
className={className}
onClick={() => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
props.setState(true);
}}
type="button"
Expand Down
1 change: 1 addition & 0 deletions components/instantsearch/sortby.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function SortIcon(props: { field: string | undefined; size: number }): ReactNode
return <CalendarArrowDown size={props.size} />;
case "title:asc":
return <ArrowDownAZ size={props.size} />;
case undefined:
default:
return <ArrowDownUp size={props.size} />;
}
Expand Down
3 changes: 0 additions & 3 deletions components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
type ListBoxProps as AriaListBoxProps,
Popover as AriaPopover,
type PopoverProps as AriaPopoverProps,
Section as AriaSection,
Select as AriaSelect,
SelectValue as AriaSelectValue,
type SelectValueProps as AriaSelectValueProps,
Expand All @@ -24,8 +23,6 @@ import {

export const Select = AriaSelect;

export const SelectSection = AriaSection;

export const SelectCollection = AriaCollection;

export function SelectValue<T extends object>({
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/app/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ test("should serve an open-graph image", async ({ createIndexPage, request }) =>
await expect(indexPage.page.locator('meta[property="og:image"]')).toHaveAttribute(
"content",
expect.stringContaining(
String(createUrl({ baseUrl: env.NEXT_PUBLIC_APP_BASE_URL, pathname: imagePath })) + `?`,
`${createUrl({ baseUrl: env.NEXT_PUBLIC_APP_BASE_URL, pathname: imagePath })}?`,
),
);

Expand Down
6 changes: 3 additions & 3 deletions lib/analytics-script.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function AnalyticsScript(props: AnalyticsProps): ReactNode {
<Fragment>
<Script
dangerouslySetInnerHTML={{
__html: `(${String(createAnalyticsScript)})("${baseUrl.endsWith("/") ? baseUrl : baseUrl + "/"}", "${String(id)}");`,
__html: `(${String(createAnalyticsScript)})("${baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`}", "${String(id)}");`,
}}
id="analytics-script"
/>
Expand All @@ -48,13 +48,13 @@ function createAnalyticsScript(baseUrl: string, id: number): void {
_paq.push(["disableCookies"]);
_paq.push(["enableHeartBeatTimer"]);
const u = baseUrl;
_paq.push(["setTrackerUrl", u + "matomo.php"]);
_paq.push(["setTrackerUrl", `${u}matomo.php`]);
_paq.push(["setSiteId", id]);
const d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
g.async = true;
g.src = u + "matomo.js";
g.src = `${u}matomo.js`;
s?.parentNode?.insertBefore(g, s);
}

Expand Down
1 change: 1 addition & 0 deletions lib/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getRequestConfig } from "next-intl/server";

import { isValidLocale } from "@/config/i18n.config";

// eslint-disable-next-line @typescript-eslint/no-deprecated
export default getRequestConfig(async ({ locale }) => {
if (!isValidLocale(locale)) notFound();

Expand Down
1 change: 1 addition & 0 deletions lib/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
redirect: _redirect,
usePathname,
useRouter,
// eslint-disable-next-line @typescript-eslint/no-deprecated
} = createSharedPathnamesNavigation({
locales,
});
Expand Down
1 change: 0 additions & 1 deletion styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ textarea {
margin-inline: auto;
padding-inline: theme("padding.4");

/* stylelint-disable-next-line media-query-no-invalid */
@media screen("md") {
padding-inline: theme("padding.8");
}
Expand Down

0 comments on commit 20cf8cb

Please sign in to comment.