Update lint rules
This commit is contained in:
@@ -7,14 +7,9 @@
|
||||
*/
|
||||
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import { AppMetadataKeys, IMetadataMigration } from '@/features/metadata/Metadata.types.ts';
|
||||
import {
|
||||
IReaderSettings,
|
||||
ProgressBarPosition,
|
||||
ReaderCustomFilter,
|
||||
ReaderPageScaleMode,
|
||||
ReadingMode,
|
||||
} from '@/features/reader/Reader.types.ts';
|
||||
import type { AppMetadataKeys, IMetadataMigration } from '@/features/metadata/Metadata.types.ts';
|
||||
import type { IReaderSettings, ReaderCustomFilter } from '@/features/reader/Reader.types.ts';
|
||||
import { ProgressBarPosition, ReaderPageScaleMode, ReadingMode } from '@/features/reader/Reader.types.ts';
|
||||
import {
|
||||
AUTO_SCROLL_SPEED,
|
||||
CUSTOM_FILTER,
|
||||
@@ -27,20 +22,25 @@ import {
|
||||
import { coerceIn, jsonSaveParse } from '@/lib/HelperFunctions.ts';
|
||||
import { DOWNLOAD_AHEAD } from '@/features/downloads/Downloads.constants.ts';
|
||||
import { MANGA_GRID_WIDTH } from '@/features/settings/Settings.constants.ts';
|
||||
import { SortSettings } from '@/features/migration/Migration.types.ts';
|
||||
import { ISourceMetadata } from '@/features/source/Source.types.ts';
|
||||
import { LibraryOptions } from '@/features/library/Library.types.ts';
|
||||
import { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts';
|
||||
import { TapZoneInvertMode } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import type { SortSettings } from '@/features/migration/Migration.types.ts';
|
||||
import type { ISourceMetadata } from '@/features/source/Source.types.ts';
|
||||
import type { LibraryOptions } from '@/features/library/Library.types.ts';
|
||||
import type { MetadataThemeSettings } from '@/features/theme/AppTheme.types.ts';
|
||||
import type { TapZoneInvertMode } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import { detectLocale, getISOLanguage } from '@/lib/ISOLanguageUtil.ts';
|
||||
import { I18nResourceCode, i18nResources } from '@/i18n';
|
||||
import type { I18nResourceCode } from '@/i18n';
|
||||
import { i18nResources } from '@/i18n';
|
||||
import { toUniqueLanguageCodes } from '@/base/utils/Languages.ts';
|
||||
|
||||
export const APP_METADATA_KEY_PREFIX = 'webUI';
|
||||
|
||||
const convertToTypeNullAndUndefined = <T>(value: string, convertToType: (value: string) => T): NullAndUndefined<T> => {
|
||||
if (value === 'null') return null;
|
||||
if (value === 'undefined') return undefined;
|
||||
if (value === 'null') {
|
||||
return null;
|
||||
}
|
||||
if (value === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
return convertToType(value);
|
||||
};
|
||||
const convertToString = (value: string): string => value;
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { MetadataServerSettingKeys, SearchMetadataKeys } from '@/features/settings/Settings.types.ts';
|
||||
import { MangaMetadataKeys } from '@/features/manga/Manga.types.ts';
|
||||
import { SourceMetadataKeys } from '@/features/source/Source.types.ts';
|
||||
import { CategoryMetadataKeys } from '@/features/category/Category.types.ts';
|
||||
import { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
import { IReaderSettings } from '@/features/reader/Reader.types.ts';
|
||||
import type { MetadataServerSettingKeys, SearchMetadataKeys } from '@/features/settings/Settings.types.ts';
|
||||
import type { MangaMetadataKeys } from '@/features/manga/Manga.types.ts';
|
||||
import type { SourceMetadataKeys } from '@/features/source/Source.types.ts';
|
||||
import type { CategoryMetadataKeys } from '@/features/category/Category.types.ts';
|
||||
import type { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
import type { IReaderSettings } from '@/features/reader/Reader.types.ts';
|
||||
|
||||
export interface IMetadataMigration {
|
||||
appKeyPrefix?: { oldPrefix: string; newPrefix: string };
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { APP_METADATA_KEY_PREFIX, GLOBAL_METADATA_KEYS } from '@/features/metadata/Metadata.constants.ts';
|
||||
import { AppMetadataKeys, Metadata } from '@/features/metadata/Metadata.types.ts';
|
||||
import type { AppMetadataKeys, Metadata } from '@/features/metadata/Metadata.types.ts';
|
||||
import { getActiveDevice } from '@/features/device/services/Device.ts';
|
||||
|
||||
export const extractOriginalKey = (key: string) => key.split('_').slice(-1)[0];
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { FieldFunctionOptions } from '@apollo/client/cache';
|
||||
import { Reference } from '@apollo/client/utilities';
|
||||
import { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
import type { FieldFunctionOptions } from '@apollo/client/cache';
|
||||
import type { Reference } from '@apollo/client/utilities';
|
||||
import type { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
|
||||
type ReadFieldFunction = FieldFunctionOptions['readField'];
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { GqlMetaHolder, Metadata, MetadataHolderType } from '@/features/metadata/Metadata.types.ts';
|
||||
import type { GqlMetaHolder, Metadata, MetadataHolderType } from '@/features/metadata/Metadata.types.ts';
|
||||
import { convertFromGqlMeta } from '@/features/metadata/services/MetadataConverter.ts';
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import { GET_GLOBAL_METADATAS } from '@/lib/graphql/metadata/GlobalMetadataQuery.ts';
|
||||
import {
|
||||
import type {
|
||||
GetGlobalMetadatasQuery,
|
||||
GetGlobalMetadatasQueryVariables,
|
||||
MetaInput,
|
||||
@@ -52,7 +52,9 @@ export class MetadataChunker {
|
||||
}
|
||||
|
||||
static getStaleChunkKeyCount(metadata: Metadata | undefined, fullKey: string): number {
|
||||
if (!metadata) return 0;
|
||||
if (!metadata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const scanFrom = (index: number): number =>
|
||||
doesMetadataKeyExistIn(metadata, this.getChunkIndexKey(fullKey, index)) ? scanFrom(index + 1) : index;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
import { AllowedMetadataValueTypes, AppMetadataKeys, Metadata } from '@/features/metadata/Metadata.types.ts';
|
||||
import type { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
||||
import type { AllowedMetadataValueTypes, AppMetadataKeys, Metadata } from '@/features/metadata/Metadata.types.ts';
|
||||
import { APP_METADATA } from '@/features/metadata/Metadata.constants.ts';
|
||||
|
||||
export const convertValueFromMetadata = <T extends AllowedMetadataValueTypes = AllowedMetadataValueTypes>(
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import type { useEffect } from 'react';
|
||||
import {
|
||||
APP_METADATA_KEY_PREFIX,
|
||||
METADATA_MIGRATIONS,
|
||||
VALID_APP_METADATA_KEYS,
|
||||
} from '@/features/metadata/Metadata.constants.ts';
|
||||
import {
|
||||
import type {
|
||||
AppMetadataKeys,
|
||||
IMetadataMigration,
|
||||
Metadata,
|
||||
@@ -21,13 +21,13 @@ import {
|
||||
MetadataKeyValuePair,
|
||||
} from '@/features/metadata/Metadata.types.ts';
|
||||
import { extractOriginalKey, getMetadataKey } from '@/features/metadata/Metadata.utils.ts';
|
||||
import { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
import { CategoryIdInfo } from '@/features/category/Category.types.ts';
|
||||
import type { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
import type { CategoryIdInfo } from '@/features/category/Category.types.ts';
|
||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||
import { getMetadataUpdateFunction } from '@/features/metadata/services/MetadataUpdater.ts';
|
||||
import { MetadataChunker } from '@/features/metadata/services/MetadataChunker.ts';
|
||||
import { SourceIdInfo } from '@/features/source/Source.types.ts';
|
||||
import { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
import type { SourceIdInfo } from '@/features/source/Source.types.ts';
|
||||
import type { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
|
||||
const getAppKeyPrefixForMigration = (migrationId: number): string => {
|
||||
const appKeyPrefix = METADATA_MIGRATIONS.slice(0, migrationId)
|
||||
|
||||
@@ -6,23 +6,23 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import type { useEffect } from 'react';
|
||||
import { convertValueFromMetadata } from '@/features/metadata/services/MetadataConverter.ts';
|
||||
import {
|
||||
import type {
|
||||
AllowedMetadataValueTypes,
|
||||
AppMetadataKeys,
|
||||
Metadata,
|
||||
MetadataHolder,
|
||||
MetadataHolderType,
|
||||
} from '@/features/metadata/Metadata.types.ts';
|
||||
import { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
import type { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
|
||||
import { CategoryIdInfo } from '@/features/category/Category.types.ts';
|
||||
import type { CategoryIdInfo } from '@/features/category/Category.types.ts';
|
||||
import { doesMetadataKeyExistIn, getMetadataKey } from '@/features/metadata/Metadata.utils.ts';
|
||||
import { MetadataChunker } from '@/features/metadata/services/MetadataChunker.ts';
|
||||
import { applyMetadataMigrations } from '@/features/metadata/services/MetadataMigrations.ts';
|
||||
import { SourceIdInfo } from '@/features/source/Source.types.ts';
|
||||
import { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
import type { SourceIdInfo } from '@/features/source/Source.types.ts';
|
||||
import type { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
import { APP_METADATA } from '@/features/metadata/Metadata.constants.ts';
|
||||
import { MetadataValueCache } from '@/features/metadata/services/MetadataValueCache.ts';
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
*/
|
||||
|
||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||
import { CategoryIdInfo } from '@/features/category/Category.types.ts';
|
||||
import {
|
||||
import type { CategoryIdInfo } from '@/features/category/Category.types.ts';
|
||||
import type {
|
||||
AppMetadataKeys,
|
||||
GqlMetaHolder,
|
||||
MetadataHolder,
|
||||
MetadataHolderType,
|
||||
MetadataKeyValuePair,
|
||||
} from '@/features/metadata/Metadata.types.ts';
|
||||
import { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
import type { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
import { getMetadataKey } from '@/features/metadata/Metadata.utils.ts';
|
||||
import { convertToGqlMeta } from '@/features/metadata/services/MetadataConverter.ts';
|
||||
import { MetadataChunker } from '@/features/metadata/services/MetadataChunker.ts';
|
||||
import { SourceIdInfo } from '@/features/source/Source.types.ts';
|
||||
import { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
import { MetaInput } from '@/lib/graphql/generated/graphql.ts';
|
||||
import type { SourceIdInfo } from '@/features/source/Source.types.ts';
|
||||
import type { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
import type { MetaInput } from '@/lib/graphql/generated/graphql.ts';
|
||||
|
||||
type MetadataUpdateOptions = {
|
||||
update?: MetadataKeyValuePair[];
|
||||
@@ -189,7 +189,9 @@ const requestBatchMetadataUpdate = async (
|
||||
holderType: MetadataHolderType,
|
||||
entries: Array<{ metadataHolders: GqlMetaHolder[]; options: MetadataUpdateOptions }>,
|
||||
): Promise<void> => {
|
||||
if (entries.length === 0) return;
|
||||
if (entries.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const processed = entries.flatMap(({ metadataHolders, options }) =>
|
||||
metadataHolders.map((metadataHolder) => ({
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { MetadataHolderType } from '@/features/metadata/Metadata.types.ts';
|
||||
import type { MetadataHolderType } from '@/features/metadata/Metadata.types.ts';
|
||||
|
||||
export class MetadataValueCache {
|
||||
private static convertedValueByKey = new Map<string, unknown>();
|
||||
|
||||
Reference in New Issue
Block a user