eslint fixes

This commit is contained in:
AnimeDL 2024-04-06 09:10:48 -07:00
parent 036440b0e5
commit 23f185c877
13 changed files with 542 additions and 597 deletions

View file

@ -1,5 +0,0 @@
lib
/videos/*.ts
build
dev.js
tsc.ts

View file

@ -1,56 +0,0 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"overrides": [
{
"files": ["gui/react/**/*"],
"rules": {
"no-console": 0
}
}
],
"rules": {
"no-console": 2,
"react/prop-types": 0,
"react-hooks/exhaustive-deps": 0,
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
"@typescript-eslint/no-unused-vars" : "warn",
"indent": [
"error",
2
],
"linebreak-style": [
"warn",
"windows"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}

View file

@ -7,15 +7,6 @@ import react from 'eslint-plugin-react';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
'lib',
'/videos/*.ts',
'build',
'dev.js',
'tsc.ts'
]
},
{
rules: {
'no-console': 2,
@ -54,5 +45,20 @@ export default tseslint.config(
},
parser: tseslint.parser
}
},
{
ignores: [
'**/lib',
'**/videos/*.ts',
'**/build',
'dev.js',
'tsc.ts'
]
},
{
files: ['gui/react/**/*'],
rules: {
'no-console': 0
}
}
);

View file

@ -261,8 +261,8 @@ const DownloadSelector: React.FC<DownloadSelectorProps> = ({ onFinish }) => {
<MenuItem value=''>No Hardsub</MenuItem>
{availableSubs.map((lang) => {
if(lang === 'all' || lang === 'none')
return undefined
return <MenuItem value={lang}>{lang}</MenuItem>
return undefined;
return <MenuItem value={lang}>{lang}</MenuItem>;
})}
</Select>
</FormControl>

View file

@ -75,7 +75,7 @@ const EpisodeListing: React.FC = () => {
</ListItem>
{store.episodeListing.filter((a) => season === 'all' ? true : a.season === season).map((item, index, { length }) => {
const e = isNaN(parseInt(item.e)) ? item.e : parseInt(item.e);
const idStr = `S${item.season}E${e}`
const idStr = `S${item.season}E${e}`;
const isSelected = selected.includes(e.toString());
const imageRef = React.createRef<HTMLImageElement>();
const summaryRef = React.createRef<HTMLParagraphElement>();
@ -133,9 +133,9 @@ const EpisodeListing: React.FC = () => {
await navigator.clipboard.writeText(item.description!);
enqueueSnackbar('Copied summary to clipboard', {
variant: 'info'
})
});
},
text: "Copy summary to clipboard"
text: 'Copy summary to clipboard'
}
]} popupItem={summaryRef} />
{index < length - 1 && <Divider />}

View file

@ -100,9 +100,9 @@ const SearchBox: React.FC = () => {
await navigator.clipboard.writeText(a.desc!);
enqueueSnackbar('Copied summary to clipboard', {
variant: 'info'
})
});
},
text: "Copy summary to clipboard"
text: 'Copy summary to clipboard'
}
]} popupItem={summaryRef} />
}

View file

@ -2,7 +2,7 @@ import { Box, Button, Menu, MenuItem, Typography } from '@mui/material';
import React from 'react';
import { messageChannelContext } from '../../provider/MessageChannel';
import useStore from '../../hooks/useStore';
import { StoreState } from '../../provider/Store'
import { StoreState } from '../../provider/Store';
const MenuBar: React.FC = () => {
const [ openMenu, setMenuOpen ] = React.useState<'settings'|'help'|undefined>();
@ -15,20 +15,20 @@ const MenuBar: React.FC = () => {
type: 'version',
payload: await messageChannel?.version()
});
}
};
getVersion();
const transformService = (service: StoreState['service']) => {
switch(service) {
case 'crunchy':
return "Crunchyroll"
return 'Crunchyroll';
case 'funi':
return "Funimation"
case "hidive":
return "Hidive"
}
return 'Funimation';
case 'hidive':
return 'Hidive';
}
};
const msg = React.useContext(messageChannelContext);

View file

@ -11,7 +11,7 @@ import Store from './provider/Store';
import ErrorHandler from './provider/ErrorHandler';
import QueueProvider from './provider/QueueProvider';
document.body.style.backgroundColor = "rgb(0, 30, 60)";
document.body.style.backgroundColor = 'rgb(0, 30, 60)';
document.body.style.display = 'flex';
document.body.style.justifyContent = 'center';

View file

@ -212,7 +212,7 @@ const MessageChannelProvider: FCWithChildren = ({ children }) => {
}
const messageHandler: FrontEndMessages = {
name: "default",
name: 'default',
auth: async (data) => (await messageAndResponse(socket, { name: 'auth', data })).data,
version: async () => (await messageAndResponse(socket, { name: 'version', data: undefined })).data,
checkToken: async () => (await messageAndResponse(socket, { name: 'checkToken', data: undefined })).data,

View file

@ -113,8 +113,8 @@
"build-macos-gui": "pnpm run prebuild-gui && cd lib && node modules/build macos-x64 true",
"build-alpine-gui": "pnpm run prebuild-gui && cd lib && node modules/build alpine-x64 true",
"build-android-gui": "pnpm run prebuild-gui && cd lib && node modules/build linuxstatic-armv7 true",
"eslint": "npx eslint *.ts modules",
"eslint-fix": "npx eslint *.ts modules --fix",
"eslint": "npx eslint .",
"eslint-fix": "npx eslint . --fix",
"pretest": "pnpm run tsc",
"test": "pnpm run pretest && cd lib && node modules/build windows-x64 && node modules/build linuxstatic-x64 && node modules/build macos-x64"
}