Update lint rules

This commit is contained in:
schroda
2026-03-11 00:11:29 +01:00
parent 5dda4304d9
commit 72af9d52d1
377 changed files with 1132 additions and 1048 deletions

View File

@@ -7,7 +7,7 @@
*/
import { CombinedGraphQLErrors } from '@apollo/client';
import { ReactNode } from 'react';
import type { ReactNode } from 'react';
export const jsonSaveParse = <T = any>(...args: Parameters<typeof JSON.parse>): T | null => {
try {

View File

@@ -6,7 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ISOLanguage, IsoLanguages } from '@/base/IsoLanguages.ts';
import type { ISOLanguage } from '@/base/IsoLanguages.ts';
import { IsoLanguages } from '@/base/IsoLanguages.ts';
import { i18nResources } from '@/i18n';
import { AppStorage } from '@/lib/storage/AppStorage.ts';

View File

@@ -6,7 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import pLimit, { LimitFunction } from 'p-limit';
import type { LimitFunction } from 'p-limit';
import pLimit from 'p-limit';
import { ControlledPromise } from '@/lib/ControlledPromise.ts';
export enum Priority {

View File

@@ -6,7 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { DAYJS_LOCALES, DayJsLocale } from '@/lib/dayjs/Locales.ts';
import type { DayJsLocale } from '@/lib/dayjs/Locales.ts';
import { DAYJS_LOCALES } from '@/lib/dayjs/Locales.ts';
import { DEFAULT_LANGUAGE } from '@/lib/ISOLanguageUtil.ts';
export const getDayJsLocale = (locale: string): DayJsLocale => {

View File

@@ -6,17 +6,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import {
MouseSensor,
PointerSensorOptions,
Sensor,
SensorDescriptor,
TouchSensor,
useSensor,
SensorOptions,
useSensors,
} from '@dnd-kit/core';
import { AbstractPointerSensorOptions, PointerActivationConstraint } from '@dnd-kit/core/dist/sensors';
import type { PointerSensorOptions, Sensor, SensorDescriptor, SensorOptions } from '@dnd-kit/core';
import { MouseSensor, TouchSensor, useSensor, useSensors } from '@dnd-kit/core';
import type { AbstractPointerSensorOptions, PointerActivationConstraint } from '@dnd-kit/core/dist/sensors';
import { MediaQuery } from '@/base/utils/MediaQuery.tsx';
export class DndKitUtil {

View File

@@ -7,7 +7,7 @@
*/
import { DragOverlay } from '@dnd-kit/core';
import { ReactNode } from 'react';
import type { ReactNode } from 'react';
export const DndOverlayItem = ({ isActive, children }: { isActive: boolean; children?: ReactNode }) => {
if (!isActive) {

View File

@@ -8,8 +8,8 @@
import Box from '@mui/material/Box';
import { useSortable } from '@dnd-kit/sortable';
import { ReactNode } from 'react';
import { UniqueIdentifier } from '@dnd-kit/core';
import type { ReactNode } from 'react';
import type { UniqueIdentifier } from '@dnd-kit/core';
import { CSS } from '@dnd-kit/utilities';
import { applyStyles } from '@/base/utils/ApplyStyles.ts';

View File

@@ -6,7 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import React, { BaseSyntheticEvent } from 'react';
import type { BaseSyntheticEvent } from 'react';
import React from 'react';
import { chainEventHandlers } from 'material-ui-popup-state/chainEventHandlers';
export class MUIUtil {

View File

@@ -6,12 +6,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { Location } from 'react-router-dom';
import type { Location } from 'react-router-dom';
type GenericLocation<State = any> = Omit<Location, 'state'> & { state?: State };
declare module 'react-router-dom' {
export function useParams<Params extends { [K in keyof Params]: string } = {}>(): Params;
export function useParams<Params extends { [K in keyof Params]: string } = Record<string, string>>(): Params;
export function useLocation<State = any>(): GenericLocation<State>;
}

View File

@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { NavigateFunction, NavigateOptions, To } from 'react-router-dom';
import type { NavigateFunction, NavigateOptions, To } from 'react-router-dom';
import { noOp } from '@/lib/HelperFunctions.ts';
export class ReactRouter {

View File

@@ -6,25 +6,24 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import {
import type {
ApolloClient,
DocumentNode,
MaybeMasked,
OperationVariables,
TypedDocumentNode,
CombinedGraphQLErrors,
} from '@apollo/client/core';
import { CombinedGraphQLErrors } from '@apollo/client/core';
import { useMutation, useQuery, useSubscription } from '@apollo/client/react';
import { Reference } from '@apollo/client/utilities';
import type { Reference } from '@apollo/client/utilities';
import { useEffect, useMemo, useRef, useState } from 'react';
import { d } from 'koration';
import { IRestClient, RestClient } from '@/lib/requests/client/RestClient.ts';
import type { IRestClient } from '@/lib/requests/client/RestClient.ts';
import { RestClient } from '@/lib/requests/client/RestClient.ts';
import { GraphQLClient } from '@/lib/requests/client/GraphQLClient.ts';
import { BaseClient } from '@/lib/requests/client/BaseClient.ts';
import {
CategoryOrderBy,
import type {
ChapterConditionInput,
ChapterOrderBy,
CheckForServerUpdatesQuery,
CheckForServerUpdatesQueryVariables,
CheckForWebuiUpdateQuery,
@@ -48,13 +47,11 @@ import {
DequeueChapterDownloadsMutationVariables,
DownloadStatusSubscription,
DownloadStatusSubscriptionVariables,
DownloadUpdateType,
EnqueueChapterDownloadMutation,
EnqueueChapterDownloadMutationVariables,
EnqueueChapterDownloadsMutation,
EnqueueChapterDownloadsMutationVariables,
FetchSourceMangaInput,
FetchSourceMangaType,
FilterChangeInput,
GetAboutQuery,
GetAboutQueryVariables,
@@ -119,7 +116,6 @@ import {
SetGlobalMetasInput,
DeleteGlobalMetasInput,
SettingsType,
SortOrder,
SourcePreferenceChangeInput,
StartDownloaderMutation,
StartDownloaderMutationVariables,
@@ -184,7 +180,6 @@ import {
UpdateLibraryMutationVariables,
GetExtensionQuery,
GetExtensionQueryVariables,
DownloaderState,
UserLoginMutation,
UserLoginMutationVariables,
UserRefreshMutation,
@@ -218,6 +213,14 @@ import {
SetCategoryMetasInput,
DeleteCategoryMetasInput,
} from '@/lib/graphql/generated/graphql.ts';
import {
CategoryOrderBy,
ChapterOrderBy,
DownloadUpdateType,
FetchSourceMangaType,
SortOrder,
DownloaderState,
} from '@/lib/graphql/generated/graphql.ts';
import { GET_GLOBAL_METADATAS } from '@/lib/graphql/metadata/GlobalMetadataQuery.ts';
import { UPDATE_GLOBAL_METADATA } from '@/lib/graphql/metadata/GlobalMetadataMutation.ts';
import {
@@ -306,7 +309,7 @@ import { RESET_WEBUI_UPDATE_STATUS, UPDATE_WEBUI } from '@/lib/graphql/server/Se
import { WEBUI_UPDATE_SUBSCRIPTION } from '@/lib/graphql/server/ServerInfoSubscription.ts';
import { GET_DOWNLOAD_STATUS } from '@/lib/graphql/download/DownloaderQuery.ts';
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
import { QueuePriority } from '@/lib/Queue.ts';
import type { QueuePriority } from '@/lib/Queue.ts';
import { SourceAwareQueue } from '@/lib/SourceAwareQueue.ts';
import { TRACKER_SEARCH } from '@/lib/graphql/tracker/TrackerQuery.ts';
import {
@@ -326,8 +329,8 @@ import { GLOBAL_METADATA } from '@/lib/graphql/common/Fragments.ts';
import { CATEGORY_META_FIELDS } from '@/lib/graphql/category/CategoryFragments.ts';
import { SOURCE_META_FIELDS } from '@/lib/graphql/source/SourceFragments.ts';
import { CHAPTER_META_FIELDS } from '@/lib/graphql/chapter/ChapterFragments.ts';
import { MetadataMigrationSettings } from '@/features/migration/Migration.types.ts';
import { MangaIdInfo } from '@/features/manga/Manga.types.ts';
import type { MetadataMigrationSettings } from '@/features/migration/Migration.types.ts';
import type { MangaIdInfo } from '@/features/manga/Manga.types.ts';
import { updateMetadataList } from '@/features/metadata/services/MetadataApolloCacheHandler.ts';
import { USER_LOGIN, USER_REFRESH } from '@/lib/graphql/user/UserMutation.ts';
import { AuthManager } from '@/features/authentication/AuthManager.ts';

View File

@@ -7,9 +7,9 @@
*/
import { AppStorage } from '@/lib/storage/AppStorage.ts';
import { UserRefreshMutation } from '@/lib/graphql/generated/graphql.ts';
import type { UserRefreshMutation } from '@/lib/graphql/generated/graphql.ts';
import { AuthManager } from '@/features/authentication/AuthManager.ts';
import { AbortableApolloMutationResponse } from '@/lib/requests/RequestManager.ts';
import type { AbortableApolloMutationResponse } from '@/lib/requests/RequestManager.ts';
import { SubpathUtil } from '@/lib/utils/SubpathUtil.ts';
import { ControlledPromise } from '@/lib/ControlledPromise.ts';

View File

@@ -12,19 +12,20 @@ import { ApolloClient, ApolloLink, CombinedGraphQLErrors, InMemoryCache } from '
import { from, filter, map, switchMap, firstValueFrom } from 'rxjs';
import UploadHttpLink from 'apollo-upload-client/UploadHttpLink.mjs';
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
import { Client, createClient } from 'graphql-ws';
import type { Client } from 'graphql-ws';
import { createClient } from 'graphql-ws';
import { getMainDefinition } from '@apollo/client/utilities';
import { TypePolicies } from '@apollo/client/cache';
import type { TypePolicies } from '@apollo/client/cache';
import { RemoveTypenameFromVariablesLink } from '@apollo/client/link/remove-typename';
import { d } from 'koration';
import { useId } from '@mantine/hooks';
import { useEffect } from 'react';
import { GraphQLFormattedError } from 'graphql';
import type { GraphQLFormattedError } from 'graphql';
import { BaseClient } from '@/lib/requests/client/BaseClient.ts';
import { StrictTypedTypePolicies } from '@/lib/graphql/generated/apollo-helpers.ts';
import type { StrictTypedTypePolicies } from '@/lib/graphql/generated/apollo-helpers.ts';
import { AuthManager } from '@/features/authentication/AuthManager.ts';
import { UserRefreshMutation } from '@/lib/graphql/generated/graphql.ts';
import { AbortableApolloMutationResponse } from '@/lib/requests/RequestManager.ts';
import type { UserRefreshMutation } from '@/lib/graphql/generated/graphql.ts';
import type { AbortableApolloMutationResponse } from '@/lib/requests/RequestManager.ts';
const typePolicies: StrictTypedTypePolicies = {
MangaType: {
@@ -320,7 +321,7 @@ export class GraphQLClient extends BaseClient<ApolloClient, ApolloClient.Options
this.wsClient = createClient({
lazy,
url: () => this.getBaseUrl().replace(/http(|s)/g, 'ws'),
url: () => this.getBaseUrl().replaceAll(/http(|s)/g, 'ws'),
keepAlive: heartbeatInterval,
retryAttempts: Number.MAX_SAFE_INTEGER,
shouldRetry: () => true,

View File

@@ -8,8 +8,8 @@
import { BaseClient } from '@/lib/requests/client/BaseClient.ts';
import { AuthManager } from '@/features/authentication/AuthManager.ts';
import { UserRefreshMutation } from '@/lib/graphql/generated/graphql.ts';
import { AbortableApolloMutationResponse } from '@/lib/requests/RequestManager.ts';
import type { UserRefreshMutation } from '@/lib/graphql/generated/graphql.ts';
import type { AbortableApolloMutationResponse } from '@/lib/requests/RequestManager.ts';
export enum HttpMethod {
GET = 'GET',

View File

@@ -6,8 +6,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ComponentProps, useRef } from 'react';
import { GroupedVirtuoso, GroupedVirtuosoHandle, StateSnapshot } from 'react-virtuoso';
import type { ComponentProps } from 'react';
import { useRef } from 'react';
import type { GroupedVirtuosoHandle, StateSnapshot } from 'react-virtuoso';
import { GroupedVirtuoso } from 'react-virtuoso';
import { useMergedRef } from '@mantine/hooks';
import { VirtuosoUtil } from '@/lib/virtuoso/Virtuoso.util.tsx';

View File

@@ -6,8 +6,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ComponentProps, useRef } from 'react';
import { GridStateSnapshot, VirtuosoGrid, VirtuosoGridHandle } from 'react-virtuoso';
import type { ComponentProps } from 'react';
import { useRef } from 'react';
import type { GridStateSnapshot, VirtuosoGridHandle } from 'react-virtuoso';
import { VirtuosoGrid } from 'react-virtuoso';
import { useMergedRef } from '@mantine/hooks';
import { VirtuosoUtil } from '@/lib/virtuoso/Virtuoso.util.tsx';

View File

@@ -6,8 +6,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { ComponentProps, useRef } from 'react';
import { StateSnapshot, Virtuoso, VirtuosoHandle } from 'react-virtuoso';
import type { ComponentProps } from 'react';
import { useRef } from 'react';
import type { StateSnapshot, VirtuosoHandle } from 'react-virtuoso';
import { Virtuoso } from 'react-virtuoso';
import { useMergedRef } from '@mantine/hooks';
import { VirtuosoUtil } from '@/lib/virtuoso/Virtuoso.util.tsx';

View File

@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { StateCreator as ZustandStateCreator } from 'zustand';
import type { StateCreator as ZustandStateCreator } from 'zustand';
export type StateCreator<T> = ZustandStateCreator<T, [['zustand/devtools', never], ['zustand/immer', never]], [], T>;