chore: upgrade prettier and fix linting errors

This commit is contained in:
Björn Dalfors
2024-03-07 14:34:12 +01:00
parent d1de0770f2
commit f25cab4682
36 changed files with 644 additions and 388 deletions

View File

@@ -12,8 +12,7 @@ import { ConfirmationRequest } from '../reducers/Global'
import { connect } from 'react-redux'
import { globalActions, settingsActions } from '../actions'
import { Theme, withStyles } from '@material-ui/core/styles'
(window as any).global = window
;(window as any).global = window
const Settings = React.lazy(() => import('./SettingsDrawer/Settings'))
const ContentView = React.lazy(() => import('./Layout/ContentView'))
@@ -68,7 +67,7 @@ class App extends React.PureComponent<Props, {}> {
return null
}
const anyProps: any = {};
const anyProps: any = {}
return (
<div className={centerContent}>

View File

@@ -43,15 +43,15 @@ class Demo extends React.Component<{ classes: any }, State> {
}
public componentDidMount() {
; (window as any).demo.enableMouse = () => {
;(window as any).demo.enableMouse = () => {
this.setState({ enabled: true })
}
; (window as any).demo.moveMouse = (x: number, y: number, animationTime: number) => {
const stepSizeX = Math.abs(this.state.position.x - x) / (animationTime / this.frameInterval)
const stepSizeY = Math.abs(this.state.position.y - y) / (animationTime / this.frameInterval)
this.setState({ stepSizeX, stepSizeY, enabled: true, target: { x, y } })
this.moveCloser()
}
;(window as any).demo.moveMouse = (x: number, y: number, animationTime: number) => {
const stepSizeX = Math.abs(this.state.position.x - x) / (animationTime / this.frameInterval)
const stepSizeY = Math.abs(this.state.position.y - y) / (animationTime / this.frameInterval)
this.setState({ stepSizeX, stepSizeY, enabled: true, target: { x, y } })
this.moveCloser()
}
}
public render() {

View File

@@ -12,7 +12,7 @@ function writeHeapdump(path?: string) {
return path
}
; (window as any).demo = {
;(window as any).demo = {
writeHeapdump,
}

View File

@@ -8,10 +8,10 @@ import { settingsActions } from '../../actions'
import { withStyles } from '@material-ui/styles'
function importAll(r: any) {
r.keys().forEach(r);
r.keys().forEach(r)
}
// @ts-expect-error -- webpack require
importAll(require.context('moment/locale', true, /\.js$/));
importAll(require.context('moment/locale', true, /\.js$/))
const moment = require('moment')

View File

@@ -43,9 +43,9 @@ class CodeDiff extends React.PureComponent<Props, State> {
private plottableLiteralsIndexedWithLineNumbers() {
const allLiterals = this.isValidJson(this.props.current) ? literalsMappedByLines(this.props.current) || [] : []
return allLiterals.map((l: JsonPropertyLocation) => (isPlottable(l.value) ? l : undefined)) as Array<
JsonPropertyLocation
>
return allLiterals.map((l: JsonPropertyLocation) =>
isPlottable(l.value) ? l : undefined
) as Array<JsonPropertyLocation>
}
private renderStyledCodeLines(changes: Array<Diff.Change>) {

View File

@@ -83,10 +83,12 @@ class ValueRenderer extends React.Component<Props, State> {
}
public render() {
return <div style={{ padding: '0px 0px 8px 0px', width: '100%' }}>
{this.props.message?.payload?.decoder === Decoder.SPARKPLUG && "Decoded SparkplugB"}
{this.renderValue()}
</div>
return (
<div style={{ padding: '0px 0px 8px 0px', width: '100%' }}>
{this.props.message?.payload?.decoder === Decoder.SPARKPLUG && 'Decoded SparkplugB'}
{this.renderValue()}
</div>
)
}
public renderValue() {

View File

@@ -40,7 +40,7 @@ function nodeDotPathToHistory(startTime: number | undefined, history: q.MessageH
let json: any = {}
try {
json = message.payload ? JSON.parse(Base64Message.toUnicodeString(message.payload)) : {}
} catch (ignore) { }
} catch (ignore) {}
const value = dotProp.get(json, dotPath)

View File

@@ -91,23 +91,26 @@ class TreeComponent extends React.PureComponent<Props, State> {
const updateInterval = Math.max(expectedRenderTime * 7, 300)
const timeUntilNextUpdate = updateInterval - (performance.now() - this.renderTime)
this.updateTimer = setTimeout(() => {
window.requestIdleCallback(
() => {
this.updateTimer && clearTimeout(this.updateTimer)
this.updateTimer = undefined
this.renderTime = performance.now()
this.updateTimer = setTimeout(
() => {
window.requestIdleCallback(
() => {
this.updateTimer && clearTimeout(this.updateTimer)
this.updateTimer = undefined
this.renderTime = performance.now()
window.requestIdleCallback(
() => {
this.setState({ lastUpdate: this.renderTime })
},
{ timeout: 100 }
)
},
{ timeout: 500 }
)
}, Math.max(0, timeUntilNextUpdate))
window.requestIdleCallback(
() => {
this.setState({ lastUpdate: this.renderTime })
},
{ timeout: 100 }
)
},
{ timeout: 500 }
)
},
Math.max(0, timeUntilNextUpdate)
)
}
public componentWillUpdate() {

View File

@@ -55,8 +55,8 @@ class UpdateNotifier extends React.PureComponent<Props, State> {
}
private async checkForUpdates() {
const ownVersion = await rendererRpc.call(getAppVersion, undefined, 10000);
const releases = await this.fetchReleases();
const ownVersion = await rendererRpc.call(getAppVersion, undefined, 10000)
const releases = await this.fetchReleases()
const newerVersions = releases
.filter(release => this.allowPrereleaseIfOwnVersionIsBeta(release, ownVersion))
.filter(release => compareVersions(release.tag_name, ownVersion) > 0)