From 9d69ab27de83ead3e499edc9028ba85749407a1e Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 23 Apr 2024 18:35:59 -0400 Subject: more lint cleanup --- src/debug/Repl.tsx | 18 ++++++++---------- src/debug/Test.tsx | 3 ++- src/debug/Viewer.tsx | 40 +++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 28 deletions(-) (limited to 'src/debug') diff --git a/src/debug/Repl.tsx b/src/debug/Repl.tsx index a9f7c085f..8ac502348 100644 --- a/src/debug/Repl.tsx +++ b/src/debug/Repl.tsx @@ -30,7 +30,7 @@ class Repl extends React.Component { if (!script.compiled) { this.executedCommands.push({ command: this.text, result: 'Compile Error' }); } else { - const result = script.run({ makeInterface }, e => this.executedCommands.push({ command: this.text, result: e.message || e })); + const result = script.run({ makeInterface }, err => this.executedCommands.push({ command: this.text, result: err.message || err })); result.success && this.executedCommands.push({ command: this.text, result: result.result }); } this.text = ''; @@ -39,15 +39,13 @@ class Repl extends React.Component { @computed get commands() { - return this.executedCommands.map(command => { - return ( -
-

{command.command}

- {/*
{JSON.stringify(command.result, null, 2)}
*/} -
{command.result instanceof RefField || command.result instanceof ObjectField ? 'object' : String(command.result)}
-
- ); - }); + return this.executedCommands.map(command => ( +
+

{command.command}

+ {/*
{JSON.stringify(command.result, null, 2)}
*/} +
{command.result instanceof RefField || command.result instanceof ObjectField ? 'object' : String(command.result)}
+
+ )); } render() { diff --git a/src/debug/Test.tsx b/src/debug/Test.tsx index c906dcc03..856cf6bd4 100644 --- a/src/debug/Test.tsx +++ b/src/debug/Test.tsx @@ -1,11 +1,12 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; -console.log('ENTERED'); + class Test extends React.Component { render() { return
HELLO WORLD
; } } + const root = ReactDOM.createRoot(document.getElementById('root')!); root.render(); diff --git a/src/debug/Viewer.tsx b/src/debug/Viewer.tsx index fc62463e6..f3295a6c6 100644 --- a/src/debug/Viewer.tsx +++ b/src/debug/Viewer.tsx @@ -1,7 +1,12 @@ +/* eslint-disable react/no-unescaped-entities */ +/* eslint-disable react/button-has-type */ +/* eslint-disable no-use-before-define */ +/* eslint-disable react/no-array-index-key */ +/* eslint-disable no-redeclare */ import { action, configure, observable } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; -import * as ReactDOM from 'react-dom'; +import * as ReactDOM from 'react-dom/client'; import { DocServer } from '../client/DocServer'; import { resolvedPorts } from '../client/util/CurrentUserUtils'; import { CompileScript } from '../client/util/Scripting'; @@ -86,14 +91,12 @@ class DocumentViewer extends React.Component<{ field: Doc }> { let content; if (this.expanded) { const keys = Object.keys(this.props.field); - const fields = keys.map(key => { - return ( -
- ({key}): - applyToDoc(this.props.field, key, value)}> -
- ); - }); + const fields = keys.map(key => ( +
+ ({key}): + applyToDoc(this.props.field, key, value)} /> +
+ )); content = (
Document ({this.props.field[Id]})
{fields}
@@ -115,7 +118,7 @@ class DocumentViewer extends React.Component<{ field: Doc }> { class DebugViewer extends React.Component<{ field: FieldResult; setValue(value: string): boolean }> { render() { let content; - const field = this.props.field; + const { field } = this.props; if (field instanceof List) { content = ; } else if (field instanceof Doc) { @@ -171,7 +174,7 @@ class Viewer extends React.Component {
{this.fields.map((field, index) => ( - false}> + false} /> ))}
@@ -181,10 +184,13 @@ class Viewer extends React.Component { (async function () { await DocServer.init(window.location.protocol, window.location.hostname, resolvedPorts.socket, 'viewer'); - ReactDOM.render( -
- -
, - document.getElementById('root') - ); + const root = document.getElementById('root'); + if (root) { + const reactDom = ReactDOM.createRoot(root); + reactDom.render( +
+ +
+ ); + } })(); -- cgit v1.2.3-70-g09d2