1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

eslint auto-fix

This commit is contained in:
Fedor Katurov 2021-11-21 16:44:19 +07:00
parent 312156bdf8
commit 4c4461ea19
55 changed files with 107 additions and 110 deletions

View file

@ -15,7 +15,6 @@ import { ModalWrapper } from '~/components/dialogs/ModalWrapper';
import { useTranslatedError } from '~/utils/hooks/useTranslatedError';
import { useCloseOnEscape } from '~/utils/hooks';
import { EditorConfirmClose } from '~/components/editors/EditorConfirmClose';
import { UploadDropzone } from '~/components/upload/UploadDropzone';
interface Props extends IDialogProps {
node: INode;
@ -46,7 +45,7 @@ const EditorDialog: FC<Props> = ({ node, onRequestClose }) => {
}
setConfirmModalShown(true);
}, [onRequestClose, dirty, isConfirmModalShown, setConfirmModalShown]);
}, [dirty, isConfirmModalShown, onRequestClose, closeConfirmModal]);
const error = useTranslatedError(status);
@ -56,7 +55,7 @@ const EditorDialog: FC<Props> = ({ node, onRequestClose }) => {
}
setStatus('');
}, [values]);
}, [setStatus, status, values]);
useCloseOnEscape(onClose);

View file

@ -1,4 +1,4 @@
import React, { FC, FormEvent, useCallback, useEffect, useMemo, useState } from 'react';
import React, { FC, FormEvent, useCallback, useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { DIALOGS, IDialogProps } from '~/redux/modal/constants';
import { useCloseOnEscape } from '~/utils/hooks';
@ -18,7 +18,6 @@ import { pick } from 'ramda';
import { LoginDialogButtons } from '~/containers/dialogs/LoginDialogButtons';
import { OAUTH_EVENT_TYPES } from '~/redux/types';
import { DialogTitle } from '~/components/dialogs/DialogTitle';
import { ERROR_LITERAL } from '~/constants/errors';
import { useTranslatedError } from '~/utils/hooks/useTranslatedError';
const mapStateToProps = state => ({
@ -60,7 +59,7 @@ const LoginDialogUnconnected: FC<IProps> = ({
event.preventDefault();
modalShowDialog(DIALOGS.RESTORE_REQUEST);
},
[modalShowDialog, userSetLoginError]
[modalShowDialog]
);
const openOauthWindow = useCallback(
@ -83,7 +82,7 @@ const LoginDialogUnconnected: FC<IProps> = ({
useEffect(() => {
if (error) userSetLoginError('');
}, [username, password]);
}, [username, password, error, userSetLoginError]);
useEffect(() => {
window.addEventListener('message', onMessage);

View file

@ -51,15 +51,15 @@ const LoginSocialRegisterDialogUnconnected: FC<Props> = ({
useEffect(() => {
if (errors.username) authSetRegisterSocialErrors({ username: '' });
}, [username]);
}, [authSetRegisterSocialErrors, errors.username, username]);
useEffect(() => {
if (errors.password) authSetRegisterSocialErrors({ password: '' });
}, [password]);
}, [authSetRegisterSocialErrors, errors.password, password]);
useEffect(() => {
if (error) authSetRegisterSocial({ error: '' });
}, [username, password]);
}, [username, password, error, authSetRegisterSocial]);
useCloseOnEscape(onRequestClose);

View file

@ -66,7 +66,7 @@ const PhotoSwipeUnconnected: FC<Props> = ({ photoswipe, modalSetShown }) => {
ps.listen('destroy', closeModal);
ps.listen('close', closeModal);
});
}, [photoswipe.images, photoswipe.index]);
}, [closeModal, photoswipe.images, photoswipe.index]);
useBlockBackButton(closeModal);

View file

@ -44,14 +44,14 @@ const RestorePasswordDialogUnconnected: FC<IProps> = ({
authRestorePassword(password);
},
[doesnt_match, authRestorePassword]
[doesnt_match, authRestorePassword, password]
);
useEffect(() => {
if (error || is_succesfull) {
authSetRestore({ error: '', is_succesfull: false });
}
}, [password, password_again]);
}, [authSetRestore, error, is_succesfull, password, password_again]);
const buttons = useMemo(
() => (
@ -80,7 +80,7 @@ const RestorePasswordDialogUnconnected: FC<IProps> = ({
) : (
undefined
),
[is_succesfull]
[is_succesfull, onRequestClose, user]
);
const not_ready = useMemo(
@ -105,7 +105,7 @@ const RestorePasswordDialogUnconnected: FC<IProps> = ({
) : (
undefined
),
[is_loading, user, error]
[is_loading, user, error, onRequestClose]
);
useCloseOnEscape(onRequestClose);

View file

@ -1,4 +1,4 @@
import React, { FC, useState, useMemo, useCallback, useEffect } from 'react';
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { IDialogProps } from '~/redux/types';
import { connect } from 'react-redux';
import { BetterScrollDialog } from '../BetterScrollDialog';
@ -45,7 +45,7 @@ const RestoreRequestDialogUnconnected: FC<IProps> = ({
if (error || is_succesfull) {
authSetRestore({ error: '', is_succesfull: false });
}
}, [field]);
}, [authSetRestore, error, field, is_succesfull]);
const buttons = useMemo(
() => (
@ -75,7 +75,7 @@ const RestoreRequestDialogUnconnected: FC<IProps> = ({
) : (
undefined
),
[is_succesfull]
[is_succesfull, onRequestClose]
);
useCloseOnEscape(onRequestClose);

View file

@ -31,10 +31,7 @@ const LoadingNode = () => (
);
const LabGrid: FC<IProps> = ({ isLoading, nodes, onLoadMore }) => {
const columns = useMemo(() => Array.from(document.querySelectorAll(`.${styles.column}`)), [
isLoading,
nodes,
]);
const columns = useMemo(() => Array.from(document.querySelectorAll(`.${styles.column}`)), []);
useLabPagination(isLoading, columns, onLoadMore);

View file

@ -24,7 +24,7 @@ const ProfileLayoutUnconnected: FC<IProps> = ({ history, nodeSetCoverImage }) =>
useEffect(() => {
if (user) setUser(undefined);
}, [username]);
}, [user, username]);
useEffect(() => {
if (user && user.id && user.cover) {
@ -33,7 +33,7 @@ const ProfileLayoutUnconnected: FC<IProps> = ({ history, nodeSetCoverImage }) =>
nodeSetCoverImage(undefined);
};
}
}, [user]);
}, [nodeSetCoverImage, user]);
return (
<Group className={styles.wrap} horizontal>

View file

@ -47,7 +47,7 @@ const ProfileMessagesUnconnected: FC<IProps> = ({
if (profile.is_loading || !profile.user || !profile.user.username) return;
messagesGetMessages(profile.user.username);
}, [profile.user]);
}, [messagesGetMessages, profile.is_loading, profile.user]);
useEffect(() => {
const timer = setInterval(messagesRefreshMessages, 20000);
@ -73,7 +73,7 @@ const ProfileMessagesUnconnected: FC<IProps> = ({
if (wasAtBottom.current) {
parent.scrollTo(0, parent.scrollHeight);
}
}, [messages.messages]);
}, [messages.messages, wrap]);
const onScroll = useCallback(() => {
const parent = wrap?.parentElement;

View file

@ -1,4 +1,4 @@
import React, { FC, useCallback, useEffect, useState } from 'react';
import React, { FC, useCallback, useEffect } from 'react';
import styles from './styles.module.scss';
import { SidebarWrapper } from '~/containers/sidebars/SidebarWrapper';
import { connect } from 'react-redux';
@ -37,11 +37,11 @@ const ProfileSidebarUnconnected: FC<Props> = ({
useEffect(() => {
authLoadProfile(username);
}, [username]);
}, [authLoadProfile, username]);
const history = useHistory();
const basePath = url.replace(new RegExp(`\/~${username}$`), '');
const onClose = useCallback(() => history.push(basePath), [basePath]);
const onClose = useCallback(() => history.push(basePath), [basePath, history]);
useCloseOnEscape(onClose);

View file

@ -1,7 +1,7 @@
import React, { FC, useEffect, useRef } from 'react';
import styles from './styles.module.scss';
import { createPortal } from 'react-dom';
import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
import { clearAllBodyScrollLocks, disableBodyScroll } from 'body-scroll-lock';
import { useCloseOnEscape } from '~/utils/hooks';
interface IProps {
@ -18,7 +18,7 @@ const SidebarWrapper: FC<IProps> = ({ children, onClose }) => {
disableBodyScroll(ref.current, { reserveScrollBarGap: true });
return () => clearAllBodyScrollLocks();
}, [ref.current]);
}, []);
return createPortal(
<div className={styles.wrapper} ref={ref}>

View file

@ -31,7 +31,7 @@ const TagSidebarUnconnected: FC<Props> = ({ nodes, tagLoadNodes, tagSetNodes })
const history = useHistory();
const basePath = url.replace(new RegExp(`\/tag\/${tag}$`), '');
const onClose = useCallback(() => history.push(basePath), [basePath]);
const onClose = useCallback(() => history.push(basePath), [basePath, history]);
useEffect(() => {
tagLoadNodes(tag);
@ -39,7 +39,7 @@ const TagSidebarUnconnected: FC<Props> = ({ nodes, tagLoadNodes, tagSetNodes })
return () => {
tagSetNodes({ list: [], count: 0 });
};
}, [tag]);
}, [tag, tagLoadNodes, tagSetNodes]);
const loadMore = useCallback(() => {
if (nodes.isLoading) return;