Skip to content

Commit

Permalink
Run eslint --fix (#3118)
Browse files Browse the repository at this point in the history
Removes various now-unused warnings and errors.
  • Loading branch information
goto-bus-stop authored Nov 16, 2024
1 parent 0d67424 commit fa7a34c
Show file tree
Hide file tree
Showing 29 changed files with 10 additions and 40 deletions.
2 changes: 1 addition & 1 deletion npm/server/bin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
/* eslint-disable no-console */

import fs from 'node:fs';
import path from 'node:path';
import express from 'express';
Expand Down
1 change: 0 additions & 1 deletion src/actions/LoginActionCreators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function socialLogin(service: string): Thunk<Promise<void>> {
window.addEventListener('message', (event) => {
const { data, origin } = event;
if (apiOrigin !== origin) {
// eslint-disable-next-line no-console
console.warn('Incorrect origin, discarding', apiUrl, origin, data);
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/admin/components/SchemaForm/ArrayField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function ArrayField({ schema, value, onChange }: ArrayFieldProps) {
<>
<Typography gutterBottom>{schema.title}</Typography>
{value.map((subValue, index) => (
// eslint-disable-next-line react/no-array-index-key
<div key={index} className="ArrayFieldElement">
<Field
className="ArrayFieldElement-field"
Expand Down
2 changes: 1 addition & 1 deletion src/admin/components/SchemaForm/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Field({
return <p style={errstyle}>Unsupported type</p>;
}

const Control = controls.get(controlName); // eslint-disable-line react/destructuring-assignment
const Control = controls.get(controlName);
if (Control) {
return (
<Control
Expand Down
2 changes: 1 addition & 1 deletion src/admin/components/ServerConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function renderSections(
key={key}
schema={schema as JSONSchema7}
defaultValue={allValues[key] as JSONSchema7Object}
onSave={onSave.bind(null, key)} // eslint-disable-line react/jsx-no-bind
onSave={onSave.bind(null, key)}
/>
));
}
Expand Down
1 change: 0 additions & 1 deletion src/components/Chat/ChatMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function useScrolledToBottom(ref: React.RefObject<HTMLElement>, initialValue = t
}

function scrollToBottom(el: HTMLElement) {
// eslint-disable-next-line no-param-reassign
el.scrollTop = el.scrollHeight;
}

Expand Down
1 change: 0 additions & 1 deletion src/components/Chat/NotificationMessages/SkipMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function SkipMessage({
const { t } = useTranslator();

try {
// eslint-disable-next-line no-param-reassign
reason = t(`booth.skip.reasons.${reason}`);
} catch {
// Not great to use try/catch for this, but not adding new APIs to `@u-wave/translate`
Expand Down
1 change: 0 additions & 1 deletion src/components/Dialogs/ConfirmDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/prop-types */
import cx from 'clsx';
import { useAsyncCallback } from 'react-async-hook';
import Dialog from '@mui/material/Dialog';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Dialogs/EditMediaDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ function EditMediaDialog({
);

const fromLabel = (
// eslint-disable-next-line jsx-a11y/label-has-for
<label htmlFor={startFieldId} className="EditMediaDialogGroup-label">
{t('dialogs.editMedia.playFromLabel')}
</label>
Expand All @@ -192,7 +191,6 @@ function EditMediaDialog({
/>
);
const toLabel = (
// eslint-disable-next-line jsx-a11y/label-has-for
<label htmlFor={endFieldId} className="EditMediaDialogGroup-label">
{t('dialogs.editMedia.playToLabel')}
</label>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialogs/LoginDialog/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SvgIcon from '../../SvgIcon';
import SocialLogin from './SocialLogin';

export type LoginFormProps = {
show: 'login', // eslint-disable-line react/no-unused-prop-types
show: 'login',
supportsSocialAuth: boolean,
onCloseDialog: () => void,
onLogin: (credentials: { email: string, password: string }) => Promise<{ error?: boolean }>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialogs/LoginDialog/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import ReCaptcha from '../../ReCaptcha';
import SocialLogin from './SocialLogin';

export type RegisterFormProps = {
show: 'register', // eslint-disable-line react/no-unused-prop-types
show: 'register',
reCaptchaSiteKey?: string,
supportsSocialAuth: boolean,
onCloseDialog: () => void,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialogs/LoginDialog/ResetPasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SvgIcon from '../../SvgIcon';
import Button from '../../Form/Button';

export type ResetPasswordFormProps = {
show: 'reset', // eslint-disable-line react/no-unused-prop-types
show: 'reset',
onResetPassword: (credentials: { email: string }) => Promise<void>,
onCloseDialog: () => void,
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dialogs/LoginDialog/SocialForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ function AvatarList({ avatars, selected, onChange }: AvatarListProps) {
}

export type SocialFormProps = {
show: 'social', // eslint-disable-line react/no-unused-prop-types
show: 'social',
service: string,
avatars: Record<string, string>,
suggestedName?: string,
onCloseDialog: () => void, // eslint-disable-line react/no-unused-prop-types
onCloseDialog: () => void,
onSocialFinish: (data: {
service: string,
params: { avatar: string, username: string }
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialogs/LoginDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import HeightTransition from './HeightTransition';
type LoginDialogProps = { open: boolean } & (
RegisterFormProps | SocialFormProps | ResetPasswordFormProps | LoginFormProps
);
/* eslint-disable react/jsx-props-no-spreading */

function LoginDialog(props: LoginDialogProps) {
const { t } = useTranslator();
const titleId = useId();
Expand Down
1 change: 0 additions & 1 deletion src/components/Dialogs/PromptDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/prop-types */
import cx from 'clsx';
import { useCallback, useId, useState } from 'react';
import { useAsyncCallback } from 'react-async-hook';
Expand Down
1 change: 0 additions & 1 deletion src/components/MediaList/BaseMediaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export function useMediaListContext<T extends ContextType<Item> = ContextType<Me
* previous one, and decide that the list is not really different.
*/
function didMediaChange(prev: (Item | null)[], next: (Item | null)[]) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return prev.some((item, i) => item && next[i] && item._id !== next[i]!._id);
}

Expand Down
1 change: 0 additions & 1 deletion src/components/PlaylistManager/Panel/Meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsx-a11y/label-has-for */
import cx from 'clsx';
import { useId } from 'react';
import { useTranslator } from '@u-wave/react-translate';
Expand Down
1 change: 0 additions & 1 deletion src/components/RoomHistory/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/prefer-default-export */
import { type ContextType, useMediaListContext } from '../MediaList/BaseMediaList';
import type { HistoryEntry } from '../../hooks/useRoomHistory';

Expand Down
2 changes: 0 additions & 2 deletions src/components/SettingsManager/GithubIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import SvgIcon, { type SvgIconProps } from '../SvgIcon';

function GithubIcon(props: SvgIconProps) {
/* eslint-disable max-len */
return (
<SvgIcon viewBox="-40 -40 520 520" {...props}>
<path d="M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8C295.736 15.166 259.057 5.365 219.27 5.365c-39.78 0-76.47 9.804-110.062 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.853 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.42-1.996 2.474-2.282 3.71-5.14 3.71-8.562 0-.57-.05-5.708-.144-15.417-.098-9.71-.144-18.18-.144-25.406l-6.567 1.136c-4.187.767-9.47 1.092-15.846 1-6.375-.09-12.992-.757-19.843-2-6.854-1.23-13.23-4.085-19.13-8.558-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.9-9.233-8.992-14.56-4.093-5.33-8.232-8.944-12.42-10.847l-1.998-1.43c-1.332-.952-2.568-2.1-3.71-3.43-1.143-1.33-1.998-2.663-2.57-3.997-.57-1.335-.097-2.43 1.428-3.29 1.525-.858 4.28-1.275 8.28-1.275l5.708.853c3.807.763 8.516 3.042 14.133 6.85 5.615 3.807 10.23 8.755 13.847 14.843 4.38 7.807 9.657 13.755 15.846 17.848 6.184 4.093 12.42 6.136 18.7 6.136 6.28 0 11.703-.476 16.273-1.423 4.565-.95 8.848-2.382 12.847-4.284 1.713-12.758 6.377-22.56 13.988-29.41-10.847-1.14-20.6-2.857-29.263-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.98-3.9-12.373-5.852-26.647-5.852-42.825 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.38-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.284 18.794 7.953 23.84 10.995 5.046 3.04 9.09 5.618 12.135 7.708 17.706-4.947 35.977-7.42 54.82-7.42s37.116 2.473 54.822 7.42l10.85-6.85c7.418-4.57 16.18-8.757 26.26-12.564 10.09-3.806 17.803-4.854 23.135-3.14 8.562 21.51 9.325 40.923 2.28 58.24 15.035 16.18 22.558 35.788 22.558 58.818 0 16.178-1.958 30.497-5.853 42.966-3.9 12.47-8.94 22.457-15.125 29.98-6.19 7.52-13.9 13.85-23.13 18.985-9.233 5.14-18.183 8.85-26.84 11.135-8.663 2.286-18.416 4.004-29.264 5.146 9.894 8.563 14.842 22.078 14.842 40.54v60.237c0 3.422 1.19 6.28 3.572 8.562 2.38 2.278 6.136 2.95 11.276 1.994 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.16 41.826-81.126 41.826-128.906-.01-39.77-9.818-76.454-29.414-110.05z" />
</SvgIcon>
);
/* eslint-enable max-len */
}

export default GithubIcon;
1 change: 0 additions & 1 deletion src/components/Video/VideoBackdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function supportsBlur() {
}

return (
// eslint-disable-next-line compat/compat
CSS.supports('filter', 'blur(1em)') || CSS.supports('-webkit-filter', 'blur(1em)')
);
}
Expand Down
1 change: 0 additions & 1 deletion src/constants/actionTypes/errors.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// eslint-disable-next-line import/prefer-default-export
export const ERROR_DISMISS = 'errors/DISMISS';
3 changes: 0 additions & 3 deletions src/loadingUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type Uwave from './Uwave';

function setLoadingText(text: string) {
Array.from(document.querySelectorAll('.LoadingIndicator-notice')).forEach((notice) => {
// eslint-disable-next-line no-param-reassign
notice.textContent = text;
});
}
Expand All @@ -30,11 +29,9 @@ export default async function load(uw: Uwave) {
} catch (err) {
setLoadingText(`Error: ${err instanceof Error ? err.message : err}`);
Array.from(document.querySelectorAll('.LoadingIndicator-loader')).forEach((el) => {
// eslint-disable-next-line no-param-reassign
(el as HTMLDivElement).hidden = true;
});
Array.from(document.querySelectorAll('.LoadingIndicator-warning')).forEach((el) => {
// eslint-disable-next-line no-param-reassign
(el as HTMLDivElement).hidden = false;
});
throw err;
Expand Down
2 changes: 0 additions & 2 deletions src/reducers/playlists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ const addPlaylistItems = createAsyncThunk('playlists/addPlaylistItems', async ({
// If there's no playlist items, we should not have a `target.before` in normal operation,
// so providing an empty list is fine. If we do get an empty list, this will at least do
// *something* and not crash, even if it's a bit wrong.
/* eslint-disable-next-line no-use-before-define */
const existingItems = playlistItemsSelector(api.getState(), playlistID) ?? [];
const payload = {
items: items.map(minimizePlaylistItem),
Expand Down Expand Up @@ -573,7 +572,6 @@ const slice = createSlice({
const items = state.playlistItems[meta.arg] ?? [];
if (items.length > 0) {
const newItems = items.slice(1);
// eslint-disable-next-line prefer-destructuring
newItems[playlist.size - 1] = items[0] ?? null;
state.playlistItems[meta.arg] = newItems;
}
Expand Down
1 change: 0 additions & 1 deletion src/redux/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as rtk from '@reduxjs/toolkit';
import type { ThunkAction } from 'redux-thunk';
import type { StoreState } from './configureStore';

// eslint-disable-next-line import/prefer-default-export
export const createAsyncThunk = rtk.createAsyncThunk.withTypes<{
state: StoreState,
}>();
Expand Down
5 changes: 0 additions & 5 deletions src/sources/youtube/__tests__/Player.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,23 @@ const fakeMedia = {
describe('sources/youtube <Player />', () => {
it('hides when the player is inactive', () => {
const { container, rerender } = render(<YouTubePlayer active={false} />);
// eslint-disable-next-line testing-library/no-node-access
expect(container.firstChild).not.toBeVisible();
rerender(<YouTubePlayer active />);
// eslint-disable-next-line testing-library/no-node-access
expect(container.firstChild).toBeVisible();
});

it('does not render an embed when video is disabled', () => {
const { container } = render(<YouTubePlayer active enabled={false} />);
// eslint-disable-next-line testing-library/no-node-access
expect(container.firstChild).toBeEmptyDOMElement();
});

it('does render an embed when video is enabled', () => {
const { container } = render(<YouTubePlayer active enabled media={fakeMedia} />);
// eslint-disable-next-line testing-library/no-node-access
expect(container.firstChild).not.toBeEmptyDOMElement();
});

it('still renders an embed when video is enabled, but YouTube is inactive', () => {
const { container } = render(<YouTubePlayer active={false} enabled media={fakeMedia} />);
// eslint-disable-next-line testing-library/no-node-access
expect(container.firstChild).not.toBeEmptyDOMElement();
});
});
1 change: 0 additions & 1 deletion src/stores/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/prefer-default-export */
import { MediaSearchStoreProvider } from './MediaSearchStore';

type AllStoresProvider = {
Expand Down
1 change: 0 additions & 1 deletion src/utils/ChatCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface Command {
name: string,
description?: string,
guard?: (state: StoreState) => boolean,
// eslint-disable-next-line no-use-before-define
action: (commander: ChatCommands, ...args: string[]) => Action | Thunk<unknown>,
}

Expand Down
2 changes: 0 additions & 2 deletions src/utils/chatMentions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function resolveMentions(tree: MarkupNode[], state: StoreState) {
const groupSelector = node.mention in groupMentions
? groupMentions[node.mention as keyof typeof groupMentions]
: null;
/* eslint-disable no-param-reassign */
if (groupSelector != null) {
const group = groupSelector(state).filter((user) => user != null);
if (group.length > 0) {
Expand All @@ -51,7 +50,6 @@ export function resolveMentions(tree: MarkupNode[], state: StoreState) {
tagWithUser(node, mentionedUser);
}
}
/* eslint-enable no-param-reassign */
} else if ('content' in node) {
resolveMentions(node.content, state);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/createTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ declare module '@mui/material/styles' {
mutedText: string,
}

interface ThemeOptions { // eslint-disable-line no-shadow
interface ThemeOptions {
uwave: UwaveThemeOptions,
}
interface Theme {
Expand Down

0 comments on commit fa7a34c

Please sign in to comment.