Migrate to oxlint + oxfmt

This commit is contained in:
schroda
2026-03-10 22:28:19 +01:00
parent 98622ad6cd
commit 5dda4304d9
40 changed files with 1232 additions and 1315 deletions

View File

@@ -10,7 +10,6 @@ declare module 'apollo-upload-client/UploadHttpLink.mjs' {
import { ApolloLink } from '@apollo/client';
import type { BaseHttpLink } from '@apollo/client/link/http';
// eslint-disable-next-line import-x/no-default-export
export default class UploadHttpLink extends ApolloLink {
constructor(options?: BaseHttpLink.ConstructorOptions);
}

View File

@@ -22,7 +22,7 @@ interface State {
}
class RealErrorBoundary extends Component<Props, State> {
// eslint-disable-next-line react/state-in-constructor
// oxlint-disable-next-line react/state-in-constructor
public state: State = { error: null };
private prevPath: string = '';
@@ -45,10 +45,9 @@ class RealErrorBoundary extends Component<Props, State> {
}
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error('Uncaught error:', error, errorInfo);
// eslint-disable-next-line react/destructuring-assignment
this.props.setTrackPathChange(true);
}

View File

@@ -27,7 +27,7 @@ export class AuthManager {
private static refreshingToken: boolean = false;
private static subscribe(callback: () => void): () => void {
// eslint-disable-next-line no-plusplus
// oxlint-disable-next-line no-plusplus
const key = AuthManager.subscribedCount++;
this.subscribers.set(key, callback);

View File

@@ -103,7 +103,7 @@ export const ChapterCard = memo((props: IProps) => {
return;
}
// eslint-disable-next-line no-param-reassign
// oxlint-disable-next-line no-param-reassign
event.shiftKey = true;
handleClick(event);
});

View File

@@ -76,10 +76,7 @@ const querySearchManga = (
{ title, genre: genres, description, artist, author, source, sourceId }: TMangaQueryFilter,
): boolean =>
performSearch([query], [title]) ||
performSearch(
query?.split(','),
genres.map((genre) => enhancedCleanup(genre)),
) ||
performSearch(query?.split(','), genres.map((genre) => enhancedCleanup(genre))) ||
performSearch([query], [description]) ||
performSearch([query], [artist]) ||
performSearch([query], [author]) ||

View File

@@ -158,7 +158,7 @@ export const SOURCES_BY_MANGA_TYPE: Record<MangaType, string[]> = {
* The actual matching data is in {@link MANGA_TAGS_BY_MANGA_TYPE} below.
*/
// @ts-ignore - see comment
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// oxlint-disable-next-line no-unused-vars
const MANGA_TAG_DESCRIPTORS_BY_MANGA_TYPE: Record<MangaType, MessageDescriptor[]> = {
[MangaType.MANGA]: [msg`Manga`],
[MangaType.COMIC]: [msg`Comic`],

View File

@@ -169,7 +169,7 @@ const VerticalGrid = ({
/>
</Box>
{/* render div to prevent UI jumping around when showing/hiding loading placeholder */}
{/* eslint-disable no-nested-ternary */}
{/* oxlint-disable no-nested-ternary */}
{isSelectModeActive && gridLayout === GridLayout.List ? (
<Box sx={{ paddingBottom: DEFAULT_FULL_FAB_HEIGHT }} />
) : isLoading ? (
@@ -177,7 +177,7 @@ const VerticalGrid = ({
) : hasNextPage ? (
<div style={{ height: '75px' }} />
) : null}
{/* eslint-enable no-nested-ternary */}
{/* oxlint-enable no-nested-ternary */}
</>
);

View File

@@ -96,7 +96,7 @@ export const MangaCard = memo((props: MangaCardProps) => {
const longPressBind = useLongPress(
useCallback(
(e: any, { context }: any) => {
// eslint-disable-next-line no-param-reassign
// oxlint-disable-next-line no-param-reassign
e.shiftKey = true;
handleClick(e, context as () => {});
},

View File

@@ -549,7 +549,7 @@ export class Mangas {
// the migration actions (copy, cleanup) are supposed to be run sequentially to ensure that the cleanup
// only happens in case the copy succeeded
// eslint-disable-next-line no-await-in-loop
// oxlint-disable-next-line no-await-in-loop
await performMigrationAction(migrationAction, ...actions);
}
};

View File

@@ -6,7 +6,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
// eslint-disable-next-line no-restricted-imports
import deepmerge from '@mui/utils/deepmerge';
import { AppMetadataKeys, IMetadataMigration } from '@/features/metadata/Metadata.types.ts';
import {

View File

@@ -120,7 +120,7 @@ export class ReaderTapZoneService {
context.beginPath();
/* eslint-disable no-param-reassign */
/* oxlint-disable no-param-reassign */
context.rect(x, y, width, height);
context.fillStyle = color;
context.strokeStyle = color;
@@ -141,7 +141,7 @@ export class ReaderTapZoneService {
context.lineWidth = 1;
context.fillStyle = 'white';
context.fillText(text, rectCenterX, rectCenterY);
/* eslint-enable no-param-reassign */
/* oxlint-enable no-param-reassign */
});
}

View File

@@ -162,7 +162,7 @@ const BaseReaderChapterViewer = ({
isCurrentChapterRef.current = isCurrentChapter;
if (isCurrentChapter) {
// eslint-disable-next-line no-param-reassign
// oxlint-disable-next-line no-param-reassign
globalImageRefs.current = imageRefs.current;
}

View File

@@ -86,7 +86,6 @@ const BaseReaderTransitionPage = ({
handleBack,
}: Pick<NavbarContextType, 'readerNavBarWidth'> & {
// gets used in the "source props creators" of the "withPropsFrom" call
// eslint-disable-next-line react/no-unused-prop-types
chapterId: ChapterIdInfo['id'];
currentChapterName?: ChapterType['name'];
currentChapterScanlator?: ChapterType['scanlator'];

View File

@@ -87,7 +87,7 @@ const BaseBasePager = ({
const setRef = useCallback(
(pagesIndex: number, element: HTMLElement | null) => {
// eslint-disable-next-line no-param-reassign
// oxlint-disable-next-line no-param-reassign
imageRefs.current[pagesIndex] = element;
},
[imageRefs],

View File

@@ -123,7 +123,7 @@ export const addStableIdToKeyValueItems = (
items: (SettingsDownloadConversionHeader | TSettingsDownloadConversionKeyValueItem)[],
): TSettingsDownloadConversionKeyValueItem[] =>
items.map((item) => ({
// eslint-disable-next-line no-plusplus
// oxlint-disable-next-line no-plusplus
id: (item as TSettingsDownloadConversionKeyValueItem).id ?? COUNTER++,
...item,
}));
@@ -132,7 +132,7 @@ export const addStableIdToConversions = (
conversions: (SettingsDownloadConversion | TSettingsDownloadConversion)[],
): TSettingsDownloadConversion[] =>
conversions.map((conversion) => ({
// eslint-disable-next-line no-plusplus
// oxlint-disable-next-line no-plusplus
id: (conversion as TSettingsDownloadConversion).id ?? COUNTER++,
...conversion,
mode: getTargetMode(normalizeMimeType(conversion.target)),

View File

@@ -51,7 +51,6 @@ export const getMetadataServerSettings = async (): Promise<MetadataServerSetting
const { data, error } = await requestManager.getGlobalMeta().response;
if (error) {
// eslint-disable-next-line @typescript-eslint/only-throw-error
throw error;
}

View File

@@ -50,7 +50,7 @@ export const TriStateFilter: React.FC<Props> = (props) => {
const [val, setval] = React.useState(convertTriStateToNumber(state));
const handleChange = (checked: boolean | null | undefined) => {
// eslint-disable-next-line no-nested-ternary
// oxlint-disable-next-line no-nested-ternary
const newState = checked === undefined ? 0 : checked ? 1 : 2;
setval(newState);
const upd = update.filter(

View File

@@ -16,7 +16,7 @@ import {
useTheme,
} from '@mui/material/styles';
import { useCallback } from 'react';
// eslint-disable-next-line no-restricted-imports
// oxlint-disable-next-line no-restricted-imports
import { deepmerge } from '@mui/utils';
import { complement, hsl, parseToHsl } from 'polished';
import { HslaColor, HslColor } from 'polished/lib/types/color';

View File

@@ -87,7 +87,7 @@ export class ThemeFontLoader {
result[font] = new Set([...(result[font] ?? []), ...weights].toSorted((a, b) => a - b));
});
// eslint-disable-next-line no-continue
// oxlint-disable-next-line no-continue
continue;
}

View File

@@ -7,4 +7,4 @@
body {
margin: 0;
}
}

View File

@@ -13,6 +13,6 @@ export const defaultPromiseErrorHandler =
return;
}
// eslint-disable-next-line no-console
// oxlint-disable-next-line no-console
console.error(`${name} failed due to`, error);
};

View File

@@ -30,7 +30,7 @@ export const importDayJsLocale = async (locale: string): Promise<DayJsLocale> =>
const dayjsLocale = getDayJsLocale(locale);
try {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
// oxlint-disable-next-line no-use-before-define
await localesToImport[dayjsLocale]();
} catch (e) {
// ignore - dayjs falls back to "en" by default

View File

@@ -103,7 +103,7 @@ export abstract class BaseClient<Client, ClientConfig, Fetcher> {
return SubpathUtil.getApiBaseUrl(serverBaseURL);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// oxlint-disable-next-line no-unused-vars
protected shouldQueueRequest(operationName?: string): boolean {
return AuthManager.shouldQueueRequests();
}

View File

@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/* eslint-disable max-classes-per-file */
/* oxlint-disable max-classes-per-file */
import { jsonSaveParse } from '@/lib/HelperFunctions.ts';
export class Storage {