From 237c718a0ad30cfe370e55d9249dbe4828ad0eca Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Wed, 15 Apr 2020 23:54:30 +0200 Subject: [PATCH] Update prettier --- app/src/actions/Charts.ts | 6 ++---- app/src/actions/Connection.ts | 2 +- app/src/actions/ConnectionManager.ts | 2 +- app/src/actions/Global.ts | 2 +- app/src/actions/Settings.ts | 10 ++-------- app/src/actions/clearTopic.ts | 4 ++-- app/src/actions/visibleTreeTraversal.ts | 4 ++-- app/src/components/App.tsx | 7 +------ app/src/components/Chart/Chart.tsx | 2 +- .../Chart/effects/useCustomYDomain.tsx | 2 +- .../ChartPanel/ChartSettings/ColorSettings.tsx | 7 ++----- .../ChartSettings/InterpolationSettings.tsx | 7 ++----- .../ChartPanel/ChartSettings/MoveUp.tsx | 5 +---- .../ChartPanel/ChartSettings/RangeSettings.tsx | 5 +---- .../ChartPanel/ChartSettings/Size.tsx | 5 +---- .../ChartSettings/TimeRangeSettings.tsx | 7 ++----- .../ChartPanel/ChartSettings/colors.ts | 2 +- app/src/components/ChartPanel/TopicChart.tsx | 5 +---- app/src/components/ChartPanel/index.tsx | 7 ++----- .../AdvancedConnectionSettings.tsx | 7 ++----- .../CertificateFileSelection.tsx | 5 +---- .../components/ConnectionSetup/Certificates.tsx | 5 +---- .../ConnectionSetup/ConnectionSettings.tsx | 5 +---- .../ConnectionSetup/ConnectionSetup.tsx | 5 +---- .../ProfileList/ConnectionItem.tsx | 5 +---- .../ConnectionSetup/ProfileList/index.tsx | 9 +++------ app/src/components/Demo/ShowText.tsx | 2 +- app/src/components/Layout/ContentView.tsx | 2 +- app/src/components/Layout/PauseButton.tsx | 5 +---- app/src/components/Layout/SearchBar.tsx | 7 ++----- app/src/components/Layout/TitleBar.tsx | 5 +---- app/src/components/SettingsDrawer/Settings.tsx | 9 ++------- .../components/SettingsDrawer/TimeLocale.tsx | 9 ++------- .../Sidebar/CodeDiff/ChartPreview.tsx | 5 +---- .../components/Sidebar/CodeDiff/DiffCount.tsx | 6 ++++-- app/src/components/Sidebar/Publish/Publish.tsx | 7 ++----- .../Sidebar/Publish/PublishHistory.tsx | 7 ++----- .../components/Sidebar/Publish/QosSelect.tsx | 5 +---- .../components/Sidebar/Publish/RetainSwitch.tsx | 5 +---- .../components/Sidebar/Publish/TopicInput.tsx | 5 +---- app/src/components/Sidebar/Sidebar.tsx | 7 +------ app/src/components/Sidebar/TopicPanel/Topic.tsx | 11 ++++------- .../Sidebar/TopicPanel/TopicPanel.tsx | 5 +---- .../Sidebar/ValueRenderer/ActionButtons.tsx | 5 +---- .../ValueRenderer/DeleteSelectedTopicButton.tsx | 5 +---- .../Sidebar/ValueRenderer/MessageHistory.tsx | 9 ++------- .../Sidebar/ValueRenderer/ValuePanel.tsx | 5 +---- app/src/components/TopicPlot.tsx | 6 +++--- .../Tree/TreeNode/TreeNodeSubnodes.tsx | 2 +- app/src/components/Tree/index.tsx | 5 +---- app/src/components/UpdateNotifier.tsx | 17 ++++++----------- .../helper/ConnectionHealthIndicator.tsx | 2 +- app/src/components/helper/Copy.tsx | 5 +---- app/src/reducers/Charts.ts | 8 +++++--- app/src/reducers/ConnectionManager.ts | 2 +- app/src/reducers/Global.ts | 2 +- app/src/sortedNodes.tsx | 2 +- backend/src/ConfigStorage.ts | 6 +++--- backend/src/DataSource/MqttSource.ts | 2 +- backend/src/JsonAstParser.ts | 2 +- backend/src/Model/Tree.ts | 2 +- backend/src/Model/TreeNode.ts | 10 +++++----- backend/src/Model/spec/EventDispatcher.spec.ts | 8 ++++---- backend/src/index.ts | 4 ++-- events/EventDispatcher.ts | 4 ++-- events/IpcRendererEventBus.ts | 4 ++-- package.json | 2 +- scripts/afterPack.ts | 4 ++-- scripts/cutScenes.ts | 4 ++-- scripts/util.ts | 2 +- src/autoUpdater.ts | 2 +- src/development.ts | 6 +++--- src/spec/mock-mqtt.ts | 4 ++-- src/spec/util/expandTopic.ts | 2 +- src/spec/util/index.ts | 2 +- yarn.lock | 8 ++++---- 76 files changed, 130 insertions(+), 257 deletions(-) diff --git a/app/src/actions/Charts.ts b/app/src/actions/Charts.ts index 960b981..e93bfe6 100644 --- a/app/src/actions/Charts.ts +++ b/app/src/actions/Charts.ts @@ -45,9 +45,7 @@ export const saveCharts = () => async (dispatch: Dispatch, getState: () => return } - const charts = getState() - .charts.get('charts') - .toArray() + const charts = getState().charts.get('charts').toArray() let viewStates: ConnectionViewStateDictionary | undefined try { @@ -69,7 +67,7 @@ export const addChart = (chartParameters: ChartParameters) => async ( const chartExists = Boolean( getState() .charts.get('charts') - .find(chart => chart.topic === chartParameters.topic && chart.dotPath === chartParameters.dotPath) + .find((chart) => chart.topic === chartParameters.topic && chart.dotPath === chartParameters.dotPath) ) if (chartExists) { dispatch(showNotification('Already added')) diff --git a/app/src/actions/Connection.ts b/app/src/actions/Connection.ts index a2e0d23..0c1801a 100644 --- a/app/src/actions/Connection.ts +++ b/app/src/actions/Connection.ts @@ -20,7 +20,7 @@ export const connect = (options: MqttOptions, connectionId: string) => ( const event = makeConnectionStateEvent(connectionId) const host = url.parse(options.url).hostname - rendererEvents.subscribe(event, dataSourceState => { + rendererEvents.subscribe(event, (dataSourceState) => { if (dataSourceState.connected) { const didReconnect = Boolean(getState().connection.tree) if (!didReconnect) { diff --git a/app/src/actions/ConnectionManager.ts b/app/src/actions/ConnectionManager.ts index f11e850..8fa274c 100644 --- a/app/src/actions/ConnectionManager.ts +++ b/app/src/actions/ConnectionManager.ts @@ -146,7 +146,7 @@ export const deleteConnection = (connectionId: string) => (dispatch: Dispatch id !== connectionId) + const remainingIds = connectionIds.filter((id) => id !== connectionId) const nextSelectedConnectionIndex = Math.min(remainingIds.length - 1, connectionIdLocation) const nextSelectedConnection = remainingIds[nextSelectedConnectionIndex] diff --git a/app/src/actions/Global.ts b/app/src/actions/Global.ts index a1b3a67..30f96fa 100644 --- a/app/src/actions/Global.ts +++ b/app/src/actions/Global.ts @@ -22,7 +22,7 @@ export const toggleSettingsVisibility = () => (dispatch: Dispatch) => { } export const requestConfirmation = (title: string, inquiry: string) => (dispatch: Dispatch) => { - return new Promise(resolve => { + return new Promise((resolve) => { const confirmationRequest = { title, inquiry, diff --git a/app/src/actions/Settings.ts b/app/src/actions/Settings.ts index e15acc6..6fa3994 100644 --- a/app/src/actions/Settings.ts +++ b/app/src/actions/Settings.ts @@ -105,11 +105,7 @@ export const filterTopics = (filterStr: string) => (dispatch: Dispatch, get const topicFilter = filterStr.toLowerCase() const nodeFilter = (node: q.TreeNode): boolean => { - const topicMatches = - node - .path() - .toLowerCase() - .indexOf(topicFilter) !== -1 + const topicMatches = node.path().toLowerCase().indexOf(topicFilter) !== -1 if (topicMatches) { return true } @@ -117,9 +113,7 @@ export const filterTopics = (filterStr: string) => (dispatch: Dispatch, get const messageMatches = node.message && node.message.value && - Base64Message.toUnicodeString(node.message.value) - .toLowerCase() - .indexOf(filterStr) !== -1 + Base64Message.toUnicodeString(node.message.value).toLowerCase().indexOf(filterStr) !== -1 return Boolean(messageMatches) } diff --git a/app/src/actions/clearTopic.ts b/app/src/actions/clearTopic.ts index 068662b..939cbe6 100644 --- a/app/src/actions/clearTopic.ts +++ b/app/src/actions/clearTopic.ts @@ -40,8 +40,8 @@ export const clearTopic = (topic: q.TreeNode, recursive: boolean) => async const publishEvent = makePublishEvent(connectionId) topicsForPurging - .filter(t => t.path() !== '' && t.hasMessage()) - .map(t => t.path()) + .filter((t) => t.path() !== '' && t.hasMessage()) + .map((t) => t.path()) .forEach((path, idx) => { const mqttMessage = { topic: path, diff --git a/app/src/actions/visibleTreeTraversal.ts b/app/src/actions/visibleTreeTraversal.ts index 233e22e..cbcbfee 100644 --- a/app/src/actions/visibleTreeTraversal.ts +++ b/app/src/actions/visibleTreeTraversal.ts @@ -82,7 +82,7 @@ function findNextNodeUpward( } const neighborNodes = sortedNodes(settings, parent) - const nodeIdx = neighborNodes.findIndex(n => n.path() === treeNode.path()) + const nodeIdx = neighborNodes.findIndex((n) => n.path() === treeNode.path()) if (nodeIdx === 0) { return parent } @@ -125,7 +125,7 @@ function findNextNodeDownwardNeighbor( } const neighborNodes = sortedNodes(settings, parent).filter(isTreeNodeVisible) - const nodeIdx = neighborNodes.findIndex(n => n.path() === treeNode.path()) + const nodeIdx = neighborNodes.findIndex((n) => n.path() === treeNode.path()) const downwardNeighbor = neighborNodes[nodeIdx + 1] if (downwardNeighbor) { return downwardNeighbor diff --git a/app/src/components/App.tsx b/app/src/components/App.tsx index 2bb533b..2260902 100644 --- a/app/src/components/App.tsx +++ b/app/src/components/App.tsx @@ -157,9 +157,4 @@ const mapStateToProps = (state: AppState) => { } } -export default withStyles(styles)( - connect( - mapStateToProps, - mapDispatchToProps - )(App) -) +export default withStyles(styles)(connect(mapStateToProps, mapDispatchToProps)(App)) diff --git a/app/src/components/Chart/Chart.tsx b/app/src/components/Chart/Chart.tsx index a438680..595458b 100644 --- a/app/src/components/Chart/Chart.tsx +++ b/app/src/components/Chart/Chart.tsx @@ -28,7 +28,7 @@ export default withTheme( memo((props: Props) => { const [width, setWidth] = React.useState(300) const [tooltip, setTooltip] = React.useState() - const detectResize = React.useCallback(newWidth => setWidth(newWidth), []) + const detectResize = React.useCallback((newWidth) => setWidth(newWidth), []) const hintFormatter = React.useCallback( (point: any) => [ diff --git a/app/src/components/Chart/effects/useCustomYDomain.tsx b/app/src/components/Chart/effects/useCustomYDomain.tsx index dfabe86..0d64361 100644 --- a/app/src/components/Chart/effects/useCustomYDomain.tsx +++ b/app/src/components/Chart/effects/useCustomYDomain.tsx @@ -27,7 +27,7 @@ function domainForData(data: Array): [number, number] { let max = data[0].y let min = data[0].y - data.forEach(d => { + data.forEach((d) => { if (max < d.y) { max = d.y } diff --git a/app/src/components/ChartPanel/ChartSettings/ColorSettings.tsx b/app/src/components/ChartPanel/ChartSettings/ColorSettings.tsx index a1c60c7..7d7862a 100644 --- a/app/src/components/ChartPanel/ChartSettings/ColorSettings.tsx +++ b/app/src/components/ChartPanel/ChartSettings/ColorSettings.tsx @@ -31,7 +31,7 @@ function ColorSettings(props: { ) const menuItems = React.useMemo(() => { - return colors.map(color => ( + return colors.map((color) => ( { } } -export default connect( - undefined, - mapDispatchToProps -)(memo(ColorSettings)) +export default connect(undefined, mapDispatchToProps)(memo(ColorSettings)) diff --git a/app/src/components/ChartPanel/ChartSettings/InterpolationSettings.tsx b/app/src/components/ChartPanel/ChartSettings/InterpolationSettings.tsx index ed3c4e6..068d61f 100644 --- a/app/src/components/ChartPanel/ChartSettings/InterpolationSettings.tsx +++ b/app/src/components/ChartPanel/ChartSettings/InterpolationSettings.tsx @@ -38,7 +38,7 @@ function InterpolationSettings(props: { }, [curves]) const menuItems = React.useMemo(() => { - return curves.map(curve => ( + return curves.map((curve) => ( {curve.replace(/_/g, ' ')} @@ -60,7 +60,4 @@ const mapDispatchToProps = (dispatch: any) => { } } -export default connect( - undefined, - mapDispatchToProps -)(InterpolationSettings) +export default connect(undefined, mapDispatchToProps)(InterpolationSettings) diff --git a/app/src/components/ChartPanel/ChartSettings/MoveUp.tsx b/app/src/components/ChartPanel/ChartSettings/MoveUp.tsx index f1db8c5..829c08f 100644 --- a/app/src/components/ChartPanel/ChartSettings/MoveUp.tsx +++ b/app/src/components/ChartPanel/ChartSettings/MoveUp.tsx @@ -33,7 +33,4 @@ const mapDispatchToProps = (dispatch: any) => { } } -export default connect( - undefined, - mapDispatchToProps -)(MoveUp) +export default connect(undefined, mapDispatchToProps)(MoveUp) diff --git a/app/src/components/ChartPanel/ChartSettings/RangeSettings.tsx b/app/src/components/ChartPanel/ChartSettings/RangeSettings.tsx index 042b40b..c6ae7db 100644 --- a/app/src/components/ChartPanel/ChartSettings/RangeSettings.tsx +++ b/app/src/components/ChartPanel/ChartSettings/RangeSettings.tsx @@ -95,10 +95,7 @@ const mapDispatchToProps = (dispatch: any) => { } } -export default connect( - undefined, - mapDispatchToProps -)(RangeSettings) +export default connect(undefined, mapDispatchToProps)(RangeSettings) function useRangeStateToFireUpdateAction( rangeFrom: string | number | undefined, diff --git a/app/src/components/ChartPanel/ChartSettings/Size.tsx b/app/src/components/ChartPanel/ChartSettings/Size.tsx index 8f884b4..f736630 100644 --- a/app/src/components/ChartPanel/ChartSettings/Size.tsx +++ b/app/src/components/ChartPanel/ChartSettings/Size.tsx @@ -47,7 +47,4 @@ const mapDispatchToProps = (dispatch: any) => { } } -export default connect( - undefined, - mapDispatchToProps -)(memo(Size)) +export default connect(undefined, mapDispatchToProps)(memo(Size)) diff --git a/app/src/components/ChartPanel/ChartSettings/TimeRangeSettings.tsx b/app/src/components/ChartPanel/ChartSettings/TimeRangeSettings.tsx index db8b29e..162d26e 100644 --- a/app/src/components/ChartPanel/ChartSettings/TimeRangeSettings.tsx +++ b/app/src/components/ChartPanel/ChartSettings/TimeRangeSettings.tsx @@ -58,7 +58,7 @@ function TimeRangeSettings(props: Props) { > Chart data within a time interval
- {ranges.map(r => { + {ranges.map((r) => { return (