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) { if (autoload) {
reloadCaptcha(); reloadCaptcha();
} }
// intentionally only executed on first render
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
const contWidth = width || 100; const contWidth = width || 100;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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