MISC: enforce eslint react checks (#640)

This commit is contained in:
Aleksei Bezrodnov
2023-06-27 04:29:44 +02:00
committed by GitHub
parent 91bfb154b6
commit 1d5a735941
68 changed files with 2062 additions and 601 deletions
+12 -10
View File
@@ -77,14 +77,6 @@ function Root(props: IProps): React.ReactElement {
currentScript = openScripts[0] ?? null;
}
useEffect(() => {
if (currentScript !== null) {
const tabIndex = currentTabIndex();
if (typeof tabIndex === "number") onTabClick(tabIndex);
parseCode(currentScript.code);
}
}, []);
useEffect(() => {
function keydown(event: KeyboardEvent): void {
if (Settings.DisableHotkeys) return;
@@ -145,10 +137,10 @@ function Root(props: IProps): React.ReactElement {
finishUpdatingRAM();
}, 300);
function parseCode(newCode: string) {
const parseCode = (newCode: string) => {
startUpdatingRAM();
debouncedCodeParsing(newCode);
}
};
// How to load function definition in monaco
// https://github.com/Microsoft/monaco-editor/issues/1415
@@ -444,6 +436,16 @@ function Root(props: IProps): React.ReactElement {
onOpenPreviousTab,
});
useEffect(() => {
if (currentScript !== null) {
const tabIndex = currentTabIndex();
if (typeof tabIndex === "number") onTabClick(tabIndex);
parseCode(currentScript.code);
}
// disable eslint because we want to run this only once on mount
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<>
<div