Fix code-style

This commit is contained in:
Thomas Nordquist
2019-04-11 19:34:23 +02:00
parent 52c44327d0
commit d1f4bc678c
22 changed files with 43 additions and 46 deletions

View File

@@ -57,7 +57,7 @@ async function openCertificate(): Promise<CertificateParameters> {
}
return new Promise((resolve, reject) => {
remote.dialog.showOpenDialog({ properties: ['openFile'], securityScopedBookmarks: true }, (filePaths?: string[]) => {
remote.dialog.showOpenDialog({ properties: ['openFile'], securityScopedBookmarks: true }, (filePaths?: Array<string>) => {
const selectedFile = filePaths && filePaths[0]
if (!selectedFile) {
reject(rejectReasons.noCertificateSelected)

View File

@@ -19,4 +19,4 @@ export const toggleSettingsVisibility = () => (dispatch: Dispatch<any>) => {
dispatch({
type: ActionTypes.toggleSettingsVisibility,
})
}
}

View File

@@ -5,7 +5,7 @@ import { AppState } from '../reducers'
import { batchActions } from 'redux-batched-actions'
import { setTopic } from './Publish'
import { TopicViewModel } from '../model/TopicViewModel'
import { globalActions } from '.';
import { globalActions } from '.'
const debounce = require('lodash.debounce')
export const selectTopic = (topic: q.TreeNode<TopicViewModel>) => (dispatch: Dispatch<any>, getState: () => AppState) => {
@@ -80,5 +80,4 @@ export const togglePause = (tree?: q.Tree<TopicViewModel>) => (dispatch: Dispatc
type: paused ? ActionTypes.TREE_RESUME_UPDATES : ActionTypes.TREE_PAUSE_UPDATES,
})
}

View File

@@ -4,7 +4,7 @@ import Key from './Key'
interface State {
message?: string
keys: string[]
keys: Array<string>
location: string
}
@@ -20,7 +20,7 @@ class Demo extends React.Component<{classes: any}, State> {
}
public componentDidMount() {
(window as any).demo.showMessage = (message: string, location: string, duration: number, keys: string[] = []) => {
(window as any).demo.showMessage = (message: string, location: string, duration: number, keys: Array<string> = []) => {
this.clearTimer()
this.setState({ message, location, keys })
this.timer = setTimeout(() => this.setState({ message: undefined }), duration)
@@ -59,7 +59,7 @@ class Demo extends React.Component<{classes: any}, State> {
return null
}
let keys: any[] = []
let keys: Array<any> = []
if (this.state.keys.length > 0) {
keys = this.state.keys.map(key => [<Key key={key} keyboardKey={key} />])
.reduce((prev, current) => {

View File

@@ -216,7 +216,7 @@ const mapDispatchToProps = (dispatch: any) => {
actions: {
settings: bindActionCreators(settingsActions, dispatch),
global: bindActionCreators(globalActions, dispatch),
}
},
}
}

View File

@@ -16,4 +16,4 @@ export enum CodeBlockColorsBraceMonokai {
string = '#E6DB74',
variable = '#A6E22E',
gutters = '#2F3129',
}
}

View File

@@ -19,7 +19,7 @@ class CodeDiff extends React.Component<Props, {}> {
super(props)
}
private renderChangeAmount(changes: Diff.Change[]) {
private renderChangeAmount(changes: Array<Diff.Change>) {
const additions = changes.map(change => (change.added === true) ? (change.count || 0) : 0).reduce((a, b) => a + b)
const deletions = changes.map(change => (change.removed === true) ? (change.count || 0) : 0).reduce((a, b) => a + b)
if (additions === 0 && deletions === 0) {

View File

@@ -10,7 +10,7 @@ interface HistoryItem {
}
interface Props {
items: HistoryItem[]
items: Array<HistoryItem>
onClick?: (index: number, element: EventTarget) => void
classes: any
contentTypeIndicator?: JSX.Element

View File

@@ -25,7 +25,6 @@ import {
withTheme,
} from '@material-ui/core'
// tslint:disable-next-line
import { default as AceEditor } from 'react-ace'
import { AppState } from '../../../reducers'
import History from '../History'
@@ -52,7 +51,7 @@ interface Props {
}
interface State {
history: Message[]
history: Array<Message>
}
class Publish extends React.Component<Props, State> {
@@ -97,7 +96,7 @@ class Publish extends React.Component<Props, State> {
// Remove duplicates
let filteredHistory = this.state.history.filter(e => e.payload !== payload || e.topic !== topic)
filteredHistory = filteredHistory.slice(-7)
const history: Message[] = [...filteredHistory, { topic, payload, sent: new Date() }]
const history: Array<Message> = [...filteredHistory, { topic, payload, sent: new Date() }]
this.setState({ history })
}

View File

@@ -191,7 +191,7 @@ const styles: StyleRulesCallback<string> = (theme: Theme) => {
},
toggleButton: {
height: '36px',
}
},
}
}

View File

@@ -1,4 +1,16 @@
import * as compareVersions from 'compare-versions'
import * as electron from 'electron'
import * as os from 'os'
import * as React from 'react'
import axios from 'axios'
import Close from '@material-ui/icons/Close'
import CloudDownload from '@material-ui/icons/CloudDownload'
import { AppState } from '../reducers'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { green } from '@material-ui/core/colors'
import { Theme, withStyles } from '@material-ui/core/styles'
import { updateNotifierActions } from '../actions'
import {
Button,
@@ -9,19 +21,6 @@ import {
SnackbarContent,
Typography,
} from '@material-ui/core'
import { Theme, withStyles } from '@material-ui/core/styles'
import { green } from '@material-ui/core/colors'
import { AppState } from '../reducers'
import Close from '@material-ui/icons/Close'
import CloudDownload from '@material-ui/icons/CloudDownload'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { updateNotifierActions } from '../actions'
import axios from 'axios'
import * as compareVersions from 'compare-versions'
import * as electron from 'electron'
import * as os from 'os'
interface Props {
showUpdateNotification: boolean
@@ -32,7 +31,7 @@ interface Props {
interface GithubRelease {
url: string,
assets?: GithubAsset[]
assets?: Array<GithubAsset>
published_at: string // "2019-01-25T20:14:39Z"
body_html: string
body: string
@@ -50,7 +49,7 @@ interface GithubAsset {
}
interface State {
newerVersions: GithubRelease[]
newerVersions: Array<GithubRelease>
}
class UpdateNotifier extends React.Component<Props, State> {
@@ -78,14 +77,14 @@ class UpdateNotifier extends React.Component<Props, State> {
return ownVersionIsBeta || !release.prerelease
}
private async fetchReleases(): Promise<GithubRelease[]> {
private async fetchReleases(): Promise<Array<GithubRelease>> {
const res = await axios.get('https://api.github.com/repos/thomasnordquist/mqtt-explorer/releases', {
headers: {
accept: 'application/vnd.github.v3.full+json',
},
})
return res.data as GithubRelease[]
return res.data as Array<GithubRelease>
}
private onCloseNotification = (event: React.SyntheticEvent<any>, reason: string) => {

View File

@@ -21,7 +21,7 @@ export interface ConnectionOptions {
certValidation: boolean
selfSignedCertificate?: CertificateParameters
clientId?: string
subscriptions: string[]
subscriptions: Array<string>
}
export function toMqttConnection(options: ConnectionOptions): MqttOptions | undefined {

View File

@@ -68,4 +68,4 @@ export const globalState: Reducer<Record<GlobalStateInterface>, GlobalAction> =
default:
return state
}
}
}

View File

@@ -1,5 +1,5 @@
import { createMuiTheme } from "@material-ui/core";
import { amber } from "@material-ui/core/colors";
import { createMuiTheme } from '@material-ui/core'
import { amber } from '@material-ui/core/colors'
const baseTheme = {
typography: {