Update linter

This commit is contained in:
Thomas Nordquist
2020-04-16 10:56:46 +02:00
parent 19e8bfdb37
commit 30af13f793
53 changed files with 92 additions and 97 deletions

View File

@@ -32,7 +32,7 @@ export default class ConfigStorage {
}
public async init() {
backendEvents.subscribe(storageStoreEvent, async (event) => {
backendEvents.subscribe(storageStoreEvent, async event => {
const ack = makeStorageAcknowledgementEvent(event.transactionId)
try {
const db = await this.getDb()
@@ -48,7 +48,7 @@ export default class ConfigStorage {
}
})
backendEvents.subscribe(storageLoadEvent, async (event) => {
backendEvents.subscribe(storageLoadEvent, async event => {
const responseEvent = makeStorageResponseEvent(event.transactionId)
try {
const db = await this.getDb()
@@ -68,7 +68,7 @@ export default class ConfigStorage {
}
})
backendEvents.subscribe(storageClearEvent, async (event) => {
backendEvents.subscribe(storageClearEvent, async event => {
try {
const db = await this.getDb()
const keys = await db.keys().value()

View File

@@ -73,7 +73,7 @@ export class MqttSource implements DataSource<MqttOptions> {
client.on('connect', () => {
this.stateMachine.setConnected(true)
options.subscriptions.forEach((subscription) => {
options.subscriptions.forEach(subscription => {
client.subscribe(subscription, (err: Error) => {
if (err) {
this.stateMachine.setError(err)

View File

@@ -70,7 +70,7 @@ function jsonToPropertyPaths(ast: JsonAst, previousPath: Array<string> = []): Ar
} else if (ast.type === 'Array') {
children = ast.children.map((value, idx) => jsonToPropertyPaths(value, previousPath.slice().concat([String(idx)])))
} else if (ast.type === 'Object') {
children = ast.children.map((property) => {
children = ast.children.map(property => {
const path = property.key.value.replace('.', '\\.')
return jsonToPropertyPaths(property.value, previousPath.slice().concat([path]))

View File

@@ -74,7 +74,7 @@ export class Tree<ViewModel extends Destroyable> extends TreeNode<ViewModel> {
}
public applyUnmergedChanges() {
this.unmergedMessages.popAll().forEach((bufferedItem) => {
this.unmergedMessages.popAll().forEach(bufferedItem => {
const edges = bufferedItem.message.topic.split('/')
const node = TreeNodeFactory.fromEdgesAndValue<ViewModel>(
edges,

View File

@@ -156,8 +156,8 @@ export class TreeNode<ViewModel extends Destroyable> {
public path(): string {
if (!this.cachedPath) {
return this.branch()
.map((node) => node.sourceEdge && node.sourceEdge.name)
.filter((name) => name !== undefined)
.map(node => node.sourceEdge && node.sourceEdge.name)
.filter(name => name !== undefined)
.join('/')
}
@@ -214,7 +214,7 @@ export class TreeNode<ViewModel extends Destroyable> {
public leafMessageCount(): number {
if (this.cachedLeafMessageCount === undefined) {
this.cachedLeafMessageCount =
this.edgeArray.map((edge) => edge.target.leafMessageCount()).reduce((a, b) => a + b, 0) + this.messages
this.edgeArray.map(edge => edge.target.leafMessageCount()).reduce((a, b) => a + b, 0) + this.messages
}
return this.cachedLeafMessageCount as number
@@ -223,7 +223,7 @@ export class TreeNode<ViewModel extends Destroyable> {
public childTopicCount(): number {
if (this.cachedChildTopicCount === undefined) {
this.cachedChildTopicCount = this.edgeArray
.map((e) => e.target.childTopicCount())
.map(e => e.target.childTopicCount())
.reduce((a, b) => a + b, this.hasMessage() ? 1 : 0)
}
@@ -239,7 +239,7 @@ export class TreeNode<ViewModel extends Destroyable> {
const initialValue = this.message && this.message.value ? [this] : []
this.cachedChildTopics = this.edgeArray
.map((e) => e.target.childTopics())
.map(e => e.target.childTopics())
.reduce((a, b) => a.concat(b), initialValue)
}

View File

@@ -8,8 +8,8 @@ describe('EventDispatcher', async () => {
this.timeout(300)
setTimeout(() => dispatcher.dispatch('hello'), 5)
const response = await new Promise((resolve) => {
dispatcher.subscribe((msg) => {
const response = await new Promise(resolve => {
dispatcher.subscribe(msg => {
resolve(msg)
})
})

View File

@@ -27,7 +27,7 @@ export class ConnectionManager {
this.connections[connectionId] = connection
const connectionStateEvent = makeConnectionStateEvent(connectionId)
connection.stateMachine.onUpdate.subscribe((state) => {
connection.stateMachine.onUpdate.subscribe(state => {
backendEvents.emit(connectionStateEvent, state)
})
@@ -72,6 +72,6 @@ export class ConnectionManager {
}
public closeAllConnections() {
Object.keys(this.connections).forEach((connectionId) => this.removeConnection(connectionId))
Object.keys(this.connections).forEach(connectionId => this.removeConnection(connectionId))
}
}