From c20678213b7630242e3e36d86447a5615e73c258 Mon Sep 17 00:00:00 2001 From: darthmaim Date: Fri, 6 Dec 2024 23:48:23 +0100 Subject: [PATCH] Fix new lint errors surfaced by `eslint@9` --- apps/web/app/[language]/achievement/[id]/component.tsx | 1 - apps/web/app/[language]/homestead/decorations/page.tsx | 1 - apps/web/app/[language]/item/[id]/_edit-content/actions.ts | 1 - apps/web/app/[language]/login/page.tsx | 1 - apps/web/components/Gw2Api/Gw2ApiProvider.tsx | 1 - apps/web/components/Gw2Api/reauthorize.ts | 1 - apps/web/components/Layout/DetailLayout.tsx | 1 - apps/web/components/Skill/SkillTooltip.client.tsx | 1 - apps/worker/src/jobs/recipes/migrations.ts | 1 - apps/worker/src/jobs/skills/migrations.ts | 1 - apps/worker/src/jobs/skins/migrations.ts | 1 - packages/ui/components/Form/Switch.tsx | 4 ++-- packages/ui/components/Table/DataTable.tsx | 2 +- packages/ui/components/Table/Table.tsx | 4 ++-- packages/ui/components/Table/use-datatable.tsx | 2 +- packages/ui/types.d.ts | 1 - 16 files changed, 6 insertions(+), 18 deletions(-) diff --git a/apps/web/app/[language]/achievement/[id]/component.tsx b/apps/web/app/[language]/achievement/[id]/component.tsx index 2670f88f4..bcb6abf71 100644 --- a/apps/web/app/[language]/achievement/[id]/component.tsx +++ b/apps/web/app/[language]/achievement/[id]/component.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react/no-array-index-key */ import type { Language } from '@gw2treasures/database'; import DetailLayout from '@/components/Layout/DetailLayout'; import { db } from '@/lib/prisma'; diff --git a/apps/web/app/[language]/homestead/decorations/page.tsx b/apps/web/app/[language]/homestead/decorations/page.tsx index 7b3342138..35e36e9d7 100644 --- a/apps/web/app/[language]/homestead/decorations/page.tsx +++ b/apps/web/app/[language]/homestead/decorations/page.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @next/next/no-img-element */ import { Trans } from '@/components/I18n/Trans'; import { createDataTable } from '@gw2treasures/ui/components/Table/DataTable'; import { db } from '@/lib/prisma'; diff --git a/apps/web/app/[language]/item/[id]/_edit-content/actions.ts b/apps/web/app/[language]/item/[id]/_edit-content/actions.ts index 43bda4be3..220fe4394 100644 --- a/apps/web/app/[language]/item/[id]/_edit-content/actions.ts +++ b/apps/web/app/[language]/item/[id]/_edit-content/actions.ts @@ -6,7 +6,6 @@ import { db } from '@/lib/prisma'; import { ContentChance, Prisma, ReviewState } from '@gw2treasures/database'; import { revalidateTag } from 'next/cache'; -// eslint-disable-next-line require-await export async function submitToReview({ itemId, removedItems, addedItems, removedCurrencies, addedCurrencies }: { itemId: number } & EditContentOrder): Promise { if(removedItems.length === 0 && addedItems.length === 0 && removedCurrencies.length === 0 && addedCurrencies.length === 0) { console.log('No changes'); diff --git a/apps/web/app/[language]/login/page.tsx b/apps/web/app/[language]/login/page.tsx index a60557bea..cefc7158a 100644 --- a/apps/web/app/[language]/login/page.tsx +++ b/apps/web/app/[language]/login/page.tsx @@ -58,7 +58,6 @@ export async function generateMetadata({ params }: PageProps): Promise }; } -// eslint-disable-next-line require-await async function redirectToGw2Me(returnTo?: string, additionalScopes?: string) { 'use server'; diff --git a/apps/web/components/Gw2Api/Gw2ApiProvider.tsx b/apps/web/components/Gw2Api/Gw2ApiProvider.tsx index 1877c505a..2c4c4ed9d 100644 --- a/apps/web/components/Gw2Api/Gw2ApiProvider.tsx +++ b/apps/web/components/Gw2Api/Gw2ApiProvider.tsx @@ -30,7 +30,6 @@ export const Gw2ApiProvider: FC = ({ children }) => { const router = useRouter(); const [hiddenAccounts, setHiddenAccounts] = useLocalStorageState('accounts.hidden', []); - // eslint-disable-next-line require-await const getAccounts = useCallback(async (requiredScopes: Scope[], optionalScopes: Scope[] = [], { includeHidden = false }: GetAccountsOptions = {}) => { // always return [] during SSR if(typeof window === 'undefined') { diff --git a/apps/web/components/Gw2Api/reauthorize.ts b/apps/web/components/Gw2Api/reauthorize.ts index b264b7fd8..a81cc2fa8 100644 --- a/apps/web/components/Gw2Api/reauthorize.ts +++ b/apps/web/components/Gw2Api/reauthorize.ts @@ -6,7 +6,6 @@ import { Scope, type AuthorizationUrlParams } from '@gw2me/client'; import { redirect } from 'next/navigation'; import 'server-only'; -// eslint-disable-next-line require-await export async function reauthorize(requiredScopes: Scope[], prompt?: AuthorizationUrlParams['prompt']) { // build redirect url diff --git a/apps/web/components/Layout/DetailLayout.tsx b/apps/web/components/Layout/DetailLayout.tsx index 1cda19f90..a7ba72e6f 100644 --- a/apps/web/components/Layout/DetailLayout.tsx +++ b/apps/web/components/Layout/DetailLayout.tsx @@ -29,7 +29,6 @@ const DetailLayout: FC = async ({ title, icon, breadcrumb, ch
- {/* eslint-disable-next-line @next/next/no-img-element */} {icon && typeof icon === 'object' && (isValidElement(icon) ? cloneElement(icon, { className: styles.icon }) : )}

{title}

{breadcrumb &&
{breadcrumb}
} diff --git a/apps/web/components/Skill/SkillTooltip.client.tsx b/apps/web/components/Skill/SkillTooltip.client.tsx index 90896fa20..7907ded10 100644 --- a/apps/web/components/Skill/SkillTooltip.client.tsx +++ b/apps/web/components/Skill/SkillTooltip.client.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @next/next/no-img-element */ import type { FC } from 'react'; import styles from './SkillTooltip.module.css'; import { Separator } from '@gw2treasures/ui/components/Layout/Separator'; diff --git a/apps/worker/src/jobs/recipes/migrations.ts b/apps/worker/src/jobs/recipes/migrations.ts index 60f824080..6a9cd2a6e 100644 --- a/apps/worker/src/jobs/recipes/migrations.ts +++ b/apps/worker/src/jobs/recipes/migrations.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Prisma } from '@gw2treasures/database'; import { toId } from '../helper/toId'; import { db } from '../../db'; diff --git a/apps/worker/src/jobs/skills/migrations.ts b/apps/worker/src/jobs/skills/migrations.ts index a59aefaf5..b8af451c8 100644 --- a/apps/worker/src/jobs/skills/migrations.ts +++ b/apps/worker/src/jobs/skills/migrations.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Prisma } from '@gw2treasures/database'; import { LocalizedObject } from '../helper/types'; import { Skill } from '@gw2api/types/data/skill'; diff --git a/apps/worker/src/jobs/skins/migrations.ts b/apps/worker/src/jobs/skins/migrations.ts index 605103a43..e9504cb57 100644 --- a/apps/worker/src/jobs/skins/migrations.ts +++ b/apps/worker/src/jobs/skins/migrations.ts @@ -21,7 +21,6 @@ interface MigratedSkin { // eslint-disable-next-line require-await export async function createMigrator() { - // eslint-disable-next-line require-await return async function migrate({ de, en, es, fr }: LocalizedObject, currentVersion = -1) { const update: MigratedSkin = { version: CURRENT_VERSION diff --git a/packages/ui/components/Form/Switch.tsx b/packages/ui/components/Form/Switch.tsx index fbe8ebaf4..34b14e867 100644 --- a/packages/ui/components/Form/Switch.tsx +++ b/packages/ui/components/Form/Switch.tsx @@ -21,7 +21,7 @@ export type SwitchControlProps = { | { type: 'radio', href?: never, replace?: never, scroll?: never, name: string, value: string } ); -export const Switch: FC & { Control: FC } = ({ children }) => { +export const Switch: FC & { Control: FC } = ({ children }: SwitchProps) => { return ( {children} @@ -29,7 +29,7 @@ export const Switch: FC & { Control: FC } = ({ ); }; -Switch.Control = ({ children, active, type = 'button', href, clickAction, name, value, icon, tip, replace, scroll }) => { +Switch.Control = ({ children, active, type = 'button', href, clickAction, name, value, icon, tip, replace, scroll }: SwitchControlProps) => { const Element = type === 'link' ? Link : type === 'radio' ? 'label' : 'button'; const element = ( diff --git a/packages/ui/components/Table/DataTable.tsx b/packages/ui/components/Table/DataTable.tsx index c11ecf22d..3dc939fb8 100644 --- a/packages/ui/components/Table/DataTable.tsx +++ b/packages/ui/components/Table/DataTable.tsx @@ -1,5 +1,5 @@ import { Table, type HeaderCellProps } from './Table'; -import { Fragment, Suspense, type FC, type Key, type ReactElement, type ReactNode } from 'react'; +import { Suspense, type FC, type Key, type ReactElement, type ReactNode } from 'react'; import 'server-only'; import { DataTableClient, DataTableClientCell, DataTableClientColumn, DataTableClientColumnSelection, DataTableClientRows } from './DataTable.client'; import { isDefined, isTruthy } from '@gw2treasures/helper/is'; diff --git a/packages/ui/components/Table/Table.tsx b/packages/ui/components/Table/Table.tsx index 228062ef9..7dc7e62bc 100644 --- a/packages/ui/components/Table/Table.tsx +++ b/packages/ui/components/Table/Table.tsx @@ -18,7 +18,7 @@ export interface HeaderCellProps { onSort?: () => void; } -const Table: FC & { HeaderCell: FC } = ({ children, width = 'page' }) => ( +const Table: FC & { HeaderCell: FC } = ({ children, width = 'page' }: TableProps) => ( {children} @@ -26,7 +26,7 @@ const Table: FC & { HeaderCell: FC } = ({ children, ); -Table.HeaderCell = function HeaderCell({ children, small = false, align, colSpan, sort, onSort }) { +Table.HeaderCell = function HeaderCell({ children, small = false, align, colSpan, sort, onSort }: HeaderCellProps) { return (
{sort ? ( diff --git a/packages/ui/components/Table/use-datatable.tsx b/packages/ui/components/Table/use-datatable.tsx index 837584014..3d9f6b319 100644 --- a/packages/ui/components/Table/use-datatable.tsx +++ b/packages/ui/components/Table/use-datatable.tsx @@ -17,7 +17,7 @@ export interface DataTableProps { /** @deprecated Use DataTable instead */ export function useDataTable(columns: DataTableColumn[], rowKey: (row: T) => Key, groups?: (row: T) => { value: string, label: ReactNode }): FC> { return memo(useMemo(() => - function DataTable({ rows }) { + function DataTable({ rows }: DataTableProps) { const [sortBy, setSortBy] = useState<{ column: DataTableColumn, reverse: boolean }>(); const sortedRows = useMemo(() => (sortBy?.column?.sort !== undefined) diff --git a/packages/ui/types.d.ts b/packages/ui/types.d.ts index 3749eb597..30fa5865d 100644 --- a/packages/ui/types.d.ts +++ b/packages/ui/types.d.ts @@ -3,7 +3,6 @@ declare module '*.module.css' { export default classes; } -// eslint-disable-next-line @typescript-eslint/no-unused-vars import type * as CSS from 'csstype'; declare module 'csstype' {