mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 10:12:53 +02:00
MISC: enforce eslint react checks (#640)
This commit is contained in:
committed by
GitHub
parent
91bfb154b6
commit
1d5a735941
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user