Remove eslint rule deactivations (#290)

This commit is contained in:
schroda
2023-05-11 18:00:37 +02:00
committed by GitHub
parent d92dc83dda
commit bd91510227
13 changed files with 38 additions and 77 deletions

View File

@@ -77,15 +77,7 @@ const MangaCard = React.forwardRef<HTMLDivElement, IProps>((props: IProps, ref)
const { t } = useTranslation(); const { t } = useTranslation();
const { const {
manga: { manga: { id, title, thumbnailUrl, downloadCount, unreadCount: unread, inLibrary },
// eslint-disable-next-line @typescript-eslint/no-unused-vars
id,
title,
thumbnailUrl,
downloadCount,
unreadCount: unread,
inLibrary,
},
gridLayout, gridLayout,
dimensions, dimensions,
inLibraryIndicator, inLibraryIndicator,

View File

@@ -64,9 +64,7 @@ const filterManga = (
return matchesSearch && matchesFilters; return matchesSearch && matchesFilters;
}); });
const sortByUnread = (a: IMangaCard, b: IMangaCard): number => const sortByUnread = (a: IMangaCard, b: IMangaCard): number => (a.unreadCount ?? 0) - (b.unreadCount ?? 0);
// eslint-disable-next-line implicit-arrow-linebreak
(a.unreadCount ?? 0) - (b.unreadCount ?? 0);
const sortByTitle = (a: IMangaCard, b: IMangaCard): number => a.title.localeCompare(b.title); const sortByTitle = (a: IMangaCard, b: IMangaCard): number => a.title.localeCompare(b.title);

View File

@@ -29,11 +29,9 @@ const defaultChapterOptions: ChapterListOptions = {
function chapterOptionsReducer(state: ChapterListOptions, actions: ChapterOptionsReducerAction): ChapterListOptions { function chapterOptionsReducer(state: ChapterListOptions, actions: ChapterOptionsReducerAction): ChapterListOptions {
switch (actions.type) { switch (actions.type) {
case 'filter': case 'filter':
// eslint-disable-next-line no-case-declarations
const active = state.unread !== false && state.downloaded !== false && state.bookmarked !== false;
return { return {
...state, ...state,
active, active: state.unread !== false && state.downloaded !== false && state.bookmarked !== false,
[actions.filterType!]: actions.filterValue, [actions.filterType!]: actions.filterValue,
}; };
case 'sortBy': case 'sortBy':

View File

@@ -17,7 +17,6 @@ interface DownloadStateIndicatorProps {
download: IDownloadChapter; download: IDownloadChapter;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP: { [state in IDownloadChapter['state']]: TranslationKey } = { const DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP: { [state in IDownloadChapter['state']]: TranslationKey } = {
Downloading: 'download.state.label.downloading', Downloading: 'download.state.label.downloading',
Error: 'download.state.label.error', Error: 'download.state.label.error',

View File

@@ -333,8 +333,6 @@ export default function ReaderNavBar(props: IProps) {
{Array(Math.max(0, chapter.chapterCount)) {Array(Math.max(0, chapter.chapterCount))
.fill(1) .fill(1)
.map((ignoreValue, index) => ( .map((ignoreValue, index) => (
// eslint-disable-next-line max-len
// eslint-disable-next-line react/no-array-index-key
<MenuItem key={`Chapter#${index + 1}`} value={index + 1}>{`${t( <MenuItem key={`Chapter#${index + 1}`} value={index + 1}>{`${t(
'chapter.title', 'chapter.title',
)} ${index + 1}`}</MenuItem> )} ${index + 1}`}</MenuItem>

View File

@@ -44,9 +44,7 @@ export default function DesktopSideBar({ navBarItems }: IProps) {
return ( return (
<SideNavBarContainer> <SideNavBarContainer>
{ {navBarItems.map(({ path, title, IconComponent, SelectedIconComponent }: NavbarItem) => (
// eslint-disable-next-line react/destructuring-assignment
navBarItems.map(({ path, title, IconComponent, SelectedIconComponent }: NavbarItem) => (
<Link to={path} style={{ color: 'inherit', textDecoration: 'none' }} key={path}> <Link to={path} style={{ color: 'inherit', textDecoration: 'none' }} key={path}>
<ListItem disableRipple button key={title}> <ListItem disableRipple button key={title}>
<ListItemIcon sx={{ minWidth: '0' }}> <ListItemIcon sx={{ minWidth: '0' }}>
@@ -56,8 +54,7 @@ export default function DesktopSideBar({ navBarItems }: IProps) {
</ListItemIcon> </ListItemIcon>
</ListItem> </ListItem>
</Link> </Link>
)) ))}
}
</SideNavBarContainer> </SideNavBarContainer>
); );
} }

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable react/destructuring-assignment */
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
* *
@@ -16,7 +14,7 @@ import IconButton from '@mui/material/IconButton';
import NavbarContext from 'components/context/NavbarContext'; import NavbarContext from 'components/context/NavbarContext';
import EmptyView from 'components/util/EmptyView'; import EmptyView from 'components/util/EmptyView';
import React, { useContext, useEffect } from 'react'; import React, { useContext, useEffect } from 'react';
import { DragDropContext, Draggable, Droppable, DropResult } from 'react-beautiful-dnd'; import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
import client from 'util/client'; import client from 'util/client';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
@@ -55,8 +53,7 @@ const DownloadQueue: React.FC = () => {
setAction(null); setAction(null);
}, [t]); }, [t]);
// eslint-disable-next-line @typescript-eslint/no-unused-vars const onDragEnd = () => {};
const onDragEnd = (result: DropResult) => {};
if (queue.length === 0) { if (queue.length === 0) {
return <EmptyView message={t('download.queue.label.no_downloads')} />; return <EmptyView message={t('download.queue.label.no_downloads')} />;
@@ -84,19 +81,19 @@ const DownloadQueue: React.FC = () => {
</NavbarToolbar> </NavbarToolbar>
<DragDropContext onDragEnd={onDragEnd}> <DragDropContext onDragEnd={onDragEnd}>
<Droppable droppableId="droppable"> <Droppable droppableId="droppable">
{(provided) => ( {(droppableProvided) => (
<Box ref={provided.innerRef} sx={{ pt: 1 }}> <Box ref={droppableProvided.innerRef} sx={{ pt: 1 }}>
{queue.map((item, index) => ( {queue.map((item, index) => (
<Draggable <Draggable
key={`${item.mangaId}-${item.chapterIndex}`} key={`${item.mangaId}-${item.chapterIndex}`}
draggableId={`${item.mangaId}-${item.chapterIndex}`} draggableId={`${item.mangaId}-${item.chapterIndex}`}
index={index} index={index}
> >
{(provided, snapshot) => ( {(draggableProvided, snapshot) => (
<Box <Box
{...provided.draggableProps} {...draggableProvided.draggableProps}
{...provided.dragHandleProps} {...draggableProvided.dragHandleProps}
ref={provided.innerRef} ref={draggableProvided.innerRef}
sx={{ p: 1, pb: 2 }} sx={{ p: 1, pb: 2 }}
> >
<Card <Card
@@ -142,7 +139,7 @@ const DownloadQueue: React.FC = () => {
)} )}
</Draggable> </Draggable>
))} ))}
{provided.placeholder} {droppableProvided.placeholder}
</Box> </Box>
)} )}
</Droppable> </Droppable>

View File

@@ -109,7 +109,6 @@ const SearchAll: React.FC = () => {
} }
setFetched({}); setFetched({});
setMangas({}); setMangas({});
// eslint-disable-next-line max-len
doIT( doIT(
sources sources
.filter(({ lang }) => shownLangs.indexOf(lang) !== -1) .filter(({ lang }) => shownLangs.indexOf(lang) !== -1)
@@ -167,7 +166,6 @@ const SearchAll: React.FC = () => {
if (query) { if (query) {
return ( return (
<> <>
{/* eslint-disable-next-line max-len */}
{sources {sources
.filter(({ lang }) => shownLangs.indexOf(lang) !== -1) .filter(({ lang }) => shownLangs.indexOf(lang) !== -1)
.filter((source) => showNsfw || !source.isNsfw) .filter((source) => showNsfw || !source.isNsfw)

View File

@@ -97,7 +97,6 @@ export default function Sources() {
return ( return (
<> <>
{/* eslint-disable-next-line max-len */}
{Object.entries(groupByLang(sources ?? [])) {Object.entries(groupByLang(sources ?? []))
.sort((a, b) => langSortCmp(a[0], b[0])) .sort((a, b) => langSortCmp(a[0], b[0]))
.map( .map(

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable react/destructuring-assignment */
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
* *
@@ -140,21 +138,21 @@ export default function Categories() {
<> <>
<DragDropContext onDragEnd={onDragEnd}> <DragDropContext onDragEnd={onDragEnd}>
<Droppable droppableId="droppable"> <Droppable droppableId="droppable">
{(provided) => ( {(droppableProvided) => (
<List ref={provided.innerRef}> <List ref={droppableProvided.innerRef}>
{categories.map((item, index) => ( {categories.map((item, index) => (
<Draggable key={item.id} draggableId={item.id.toString()} index={index}> <Draggable key={item.id} draggableId={item.id.toString()} index={index}>
{(provided, snapshot) => ( {(draggableProvided, snapshot) => (
<ListItem <ListItem
ContainerProps={{ ref: provided.innerRef } as any} ContainerProps={{ ref: draggableProvided.innerRef } as any}
{...provided.draggableProps} {...draggableProvided.draggableProps}
{...provided.dragHandleProps} {...draggableProvided.dragHandleProps}
style={getItemStyle( style={getItemStyle(
snapshot.isDragging, snapshot.isDragging,
provided.draggableProps.style, draggableProvided.draggableProps.style,
theme.palette, theme.palette,
)} )}
ref={provided.innerRef} ref={draggableProvided.innerRef}
> >
<ListItemIcon> <ListItemIcon>
<DragHandleIcon /> <DragHandleIcon />
@@ -180,7 +178,7 @@ export default function Categories() {
)} )}
</Draggable> </Draggable>
))} ))}
{provided.placeholder} {droppableProvided.placeholder}
</List> </List>
)} )}
</Droppable> </Droppable>

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable react/destructuring-assignment */
/* /*
* Copyright (C) Contributors to the Suwayomi project * Copyright (C) Contributors to the Suwayomi project
* *

View File

@@ -6,7 +6,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
function getItem<T>(key: string, defaultValue: T): T { function getItem<T>(key: string, defaultValue: T): T {
try {
const item = window.localStorage.getItem(key); const item = window.localStorage.getItem(key);
if (item !== null) { if (item !== null) {
@@ -14,20 +13,11 @@ function getItem<T>(key: string, defaultValue: T): T {
} }
window.localStorage.setItem(key, JSON.stringify(defaultValue)); window.localStorage.setItem(key, JSON.stringify(defaultValue));
/* eslint-disable no-empty */
} finally {
}
return defaultValue; return defaultValue;
} }
function setItem<T>(key: string, value: T): void { function setItem<T>(key: string, value: T): void {
try {
window.localStorage.setItem(key, JSON.stringify(value)); window.localStorage.setItem(key, JSON.stringify(value));
// eslint-disable-next-line no-empty
} finally {
}
} }
export default { getItem, setItem }; export default { getItem, setItem };

View File

@@ -8,7 +8,6 @@
import React, { useState, Dispatch, SetStateAction, useReducer, Reducer, useCallback } from 'react'; import React, { useState, Dispatch, SetStateAction, useReducer, Reducer, useCallback } from 'react';
import storage from 'util/localStorage'; import storage from 'util/localStorage';
// eslint-disable-next-line max-len
export default function useLocalStorage<T>(key: string, defaultValue: T | (() => T)): [T, Dispatch<SetStateAction<T>>] { export default function useLocalStorage<T>(key: string, defaultValue: T | (() => T)): [T, Dispatch<SetStateAction<T>>] {
const initialState = defaultValue instanceof Function ? defaultValue() : defaultValue; const initialState = defaultValue instanceof Function ? defaultValue() : defaultValue;
const [storedValue, setStoredValue] = useState<T>(storage.getItem(key, initialState)); const [storedValue, setStoredValue] = useState<T>(storage.getItem(key, initialState));