fix some eslint errors

This commit is contained in:
HF 2024-01-24 00:59:22 +01:00
parent dbf46556c8
commit ad200cfcad
19 changed files with 30 additions and 36 deletions

View File

@ -59,6 +59,8 @@ const Captcha = ({ autoload, width, setLegit }) => {
if (autoload) {
reloadCaptcha();
}
// intentionally only executed on first render
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const contWidth = width || 100;

View File

@ -145,6 +145,7 @@ function Converter() {
extraOpts,
scaleData,
gridData,
canvases,
]);
const {
@ -171,17 +172,17 @@ function Converter() {
if (showExtraOptions) {
setTimeout(() => setExtraRender(true), 10);
}
}, [selectedStrategy]);
}, [showExtraOptions]);
useEffect(() => {
if (gridEnabled) {
setTimeout(() => setGridRender(true), 10);
}
}, [gridData.enabled]);
}, [gridEnabled]);
useEffect(() => {
if (scalingEnabled) {
setTimeout(() => setScalingRender(true), 10);
}
}, [scaleData.enabled]);
}, [scalingEnabled]);
const gimpLink = <a href="https://www.gimp.org">GIMP</a>;

View File

@ -65,7 +65,7 @@ const HistorySelect = () => {
setTime(date, newTimes[0]);
}
setSubmitting(false);
}, [submitting, times]);
}, [submitting, canvasId, setTime]);
const changeTime = useCallback(async (diff) => {
if (!times.length
@ -97,7 +97,7 @@ const HistorySelect = () => {
setTimes(newTimes);
setTime(newSelectedDate, newTimes[newPos]);
}, [historicalTime, times, submitting]);
}, [historicalTime, times, canvasId, setTime]);
const selectedDate = stringToDate(historicalDate);
const selectedTime = stringToTime(historicalTime);

View File

@ -11,12 +11,11 @@ import { t } from 'ttag';
import { MONTH } from '../core/constants';
function LanguageSelect() {
const { lang, langs } = window.ssv;
const [langSel, setLangSel] = useState(lang);
const [langSel, setLangSel] = useState(window.ssv.lang);
const [ccSel, setCCSel] = useState('xx');
useEffect(() => {
const { langs } = window.ssv;
for (let i = 0; i < langs.length; i += 1) {
const [lc, cc] = langs[i];
if (lc === langSel) {
@ -41,7 +40,7 @@ function LanguageSelect() {
}}
>
{
langs.map(([l]) => (
window.ssv.langs.map(([l]) => (
<option
key={l}
value={l}

View File

@ -17,7 +17,7 @@ const NotifyBox = () => {
setClassName(newClassName);
}
}
}, [notification]);
}, [notification, className]);
return (
<div

View File

@ -83,7 +83,7 @@ const Rankings = () => {
return null;
}
return getOnlineStatsData(onlineStats, pHourlyStats);
}, [area, onlineStats]);
}, [area, onlineStats, pHourlyStats]);
const onlineOpts = useMemo(() => {
if (area !== 'charts') {

View File

@ -28,7 +28,7 @@ const UIPopUp = () => {
setTitle: (title) => dispatch(setWindowTitle(title)),
// eslint-disable-next-line max-len
changeType: (newType, newTitle, newArgs) => dispatch(changeWindowType(newType, newTitle, newArgs)),
}), [args]);
}), [args, dispatch]);
return (
<div

View File

@ -69,7 +69,7 @@ const ChatButton = () => {
if (i === cids.length) {
setUnreadAny(false);
}
});
}, [chatNotify, chatOpen, channels, unread, mute]);
return (
<div

View File

@ -59,7 +59,7 @@ const MovementControls = () => {
break;
default:
}
}, []);
}, [dispatch]);
const onPressStop = useCallback((event) => {
event.preventDefault();
@ -84,12 +84,12 @@ const MovementControls = () => {
break;
default:
}
}, []);
}, [dispatch]);
const onCancel = useCallback((event) => {
event.preventDefault();
dispatch(cancelMove());
}, []);
}, [dispatch]);
const refCallBack = useCallback((node) => {
if (!node) {

View File

@ -51,7 +51,7 @@ const ChannelDropDown = ({
setType(chType);
}
}
}, [show]);
}, [show, channels, chatChannel]);
useEffect(() => {
const cids = Object.keys(channels);
@ -90,7 +90,7 @@ const ChannelDropDown = ({
if (i === cids.length) {
setUnreadAny(false);
}
}, [channels, unread]);
}, [channels, unread, mute, unreadAny]);
useEffect(() => {
const cids = Object.keys(channels);

View File

@ -27,7 +27,7 @@ const TikTok = ({ url }) => {
}
}
fetchData();
}, []);
}, [url]);
if (!embedCode) {
return <div>LOADING</div>;

View File

@ -19,7 +19,7 @@ export function useConditionalClickOutside(insideRefs, active, callback) {
|| !ref.current.contains(event.target))) {
callback();
}
}, [callback]);
}, [callback, insideRefs]);
const handleWindowResize = useCallback(() => {
callback();
@ -37,7 +37,7 @@ export function useConditionalClickOutside(insideRefs, active, callback) {
});
window.removeEventListener('resize', handleWindowResize);
}
}, [active, callback]);
}, [active, handleClickOutside, handleWindowResize]);
}
/*

View File

@ -126,7 +126,7 @@ function useLink() {
// open within window
contextData.changeType(windowType, title, args);
}, [contextData]);
}, [contextData, dispatch]);
}
export default useLink;

View File

@ -19,7 +19,7 @@ function usePostMessage(iFrameRef, callback) {
window.addEventListener('message', handleMessage, false);
return () => window.removeEventListener('message', handleMessage);
}, []);
}, [iFrameRef]);
}
export default usePostMessage;

View File

@ -1,6 +1,4 @@
/*
* @flex
*
* can be used in react components
* to trigger on window resize
*/

View File

@ -53,7 +53,7 @@ const SettingsItemSelect = ({
</div>
);
function Settings() {
const Settings = () => {
const [
isGridShown,
isPixelNotifyShown,
@ -194,6 +194,6 @@ function Settings() {
)}
</div>
);
}
};
export default React.memo(Settings);

View File

@ -42,7 +42,7 @@ const UserArea = () => {
activeTab: label,
});
setTitle(label);
}, [setArgs]);
}, [setArgs, setTitle]);
useInterval(() => {
if (Date.now() - 300000 > lastStatsFetch) {

View File

@ -122,7 +122,6 @@ class VoxelPainterControls {
storeViewInStateTime = Date.now();
prevTime = Date.now();
offset = new Vector3();
direction = new Vector3();
velocity = new Vector3();
vec = new Vector3();
// forcing next update
@ -622,7 +621,6 @@ class VoxelPainterControls {
camera,
target,
velocity,
direction,
offset,
vec,
spherical,

View File

@ -17,12 +17,8 @@ import {
setMoveV,
setMoveW,
} from '../store/actions';
import {
HOLD_PAINT,
} from '../core/constants';
import {
notify,
} from '../store/actions/thunks';
import { HOLD_PAINT } from '../core/constants';
import { notify } from '../store/actions/thunks';
const charKeys = ['g', 'h', 'x', 'm', 'r', 'p', '+', '-'];