From 8dcf72d144b2183e999e52a1bbc7ff062b644f31 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Feb 2018 14:11:03 -0800 Subject: [PATCH] lint fixes --- routes/_actions/instances.js | 5 ++--- routes/_actions/pinnedStatuses.js | 6 ++---- routes/_actions/search.js | 4 ++-- routes/_actions/streaming.js | 12 ++++++------ routes/_database/timelines.js | 4 ++-- routes/_store/instanceObservers.js | 2 +- routes/_store/timelineObservers.js | 1 - routes/_utils/ajax.js | 2 +- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/routes/_actions/instances.js b/routes/_actions/instances.js index 893f6602..06828191 100644 --- a/routes/_actions/instances.js +++ b/routes/_actions/instances.js @@ -67,8 +67,7 @@ export async function updateVerifyCredentialsForInstance (instanceName) { ) } - -export async function updateInstanceInfo(instanceName) { +export async function updateInstanceInfo (instanceName) { await cacheFirstUpdateAfter( () => getInstanceInfo(instanceName), () => database.getInstanceInfo(instanceName), @@ -79,4 +78,4 @@ export async function updateInstanceInfo(instanceName) { store.set({instanceInfos: instanceInfos}) } ) -} \ No newline at end of file +} diff --git a/routes/_actions/pinnedStatuses.js b/routes/_actions/pinnedStatuses.js index 4956c0e5..9e6e10f9 100644 --- a/routes/_actions/pinnedStatuses.js +++ b/routes/_actions/pinnedStatuses.js @@ -3,7 +3,7 @@ import { cacheFirstUpdateAfter } from '../_utils/sync' import { getPinnedStatuses } from '../_api/pinnedStatuses' import { database } from '../_database/database' -export async function updatePinnedStatusesForAccount(accountId) { +export async function updatePinnedStatusesForAccount (accountId) { let instanceName = store.get('currentInstance') let accessToken = store.get('accessToken') @@ -18,6 +18,4 @@ export async function updatePinnedStatusesForAccount(accountId) { store.set({pinnedStatuses: $pinnedStatuses}) } ) - - -} \ No newline at end of file +} diff --git a/routes/_actions/search.js b/routes/_actions/search.js index 990c0d25..2fb25d8f 100644 --- a/routes/_actions/search.js +++ b/routes/_actions/search.js @@ -2,7 +2,7 @@ import { store } from '../_store/store' import { toast } from '../_utils/toast' import { search } from '../_api/search' -export async function doSearch() { +export async function doSearch () { let instanceName = store.get('currentInstance') let accessToken = store.get('accessToken') let queryInSearch = store.get('queryInSearch') @@ -22,4 +22,4 @@ export async function doSearch() { } finally { store.set({searchLoading: false}) } -} \ No newline at end of file +} diff --git a/routes/_actions/streaming.js b/routes/_actions/streaming.js index a584fef7..f0efbef2 100644 --- a/routes/_actions/streaming.js +++ b/routes/_actions/streaming.js @@ -50,8 +50,8 @@ function handleStreamMessage (instanceName, timelineName, message) { } export function createStream (streamingApi, instanceName, accessToken, timelineName) { - new TimelineStream(streamingApi, accessToken, timelineName, { - onMessage(msg) { + return new TimelineStream(streamingApi, accessToken, timelineName, { + onMessage (msg) { console.log('message', msg) if (msg.event !== 'update' && msg.event !== 'delete') { console.error("don't know how to handle event", msg) @@ -61,14 +61,14 @@ export function createStream (streamingApi, instanceName, accessToken, timelineN handleStreamMessage(instanceName, timelineName, msg) }) }, - onOpen() { + onOpen () { console.log('opened stream for timeline', timelineName) }, - onClose() { + onClose () { console.log('closed stream for timeline', timelineName) }, - onReconnect() { + onReconnect () { console.log('reconnected stream for timeline', timelineName) } }) -} \ No newline at end of file +} diff --git a/routes/_database/timelines.js b/routes/_database/timelines.js index ac2eca4a..46f4dafa 100644 --- a/routes/_database/timelines.js +++ b/routes/_database/timelines.js @@ -57,7 +57,7 @@ function cloneForStorage (obj) { return res } -function cacheStatus(status, instanceName) { +function cacheStatus (status, instanceName) { setInCache(statusesCache, instanceName, status.id, status) setInCache(accountsCache, instanceName, status.account.id, status.account) if (status.reblog) { @@ -318,4 +318,4 @@ export async function getPinnedStatuses (instanceName, accountId) { callback(res) } }) -} \ No newline at end of file +} diff --git a/routes/_store/instanceObservers.js b/routes/_store/instanceObservers.js index a97a2146..715b4118 100644 --- a/routes/_store/instanceObservers.js +++ b/routes/_store/instanceObservers.js @@ -10,4 +10,4 @@ export function instanceObservers (store) { updateInstanceInfo(currentInstance) updateLists() }) -} \ No newline at end of file +} diff --git a/routes/_store/timelineObservers.js b/routes/_store/timelineObservers.js index 927b148f..db6207f7 100644 --- a/routes/_store/timelineObservers.js +++ b/routes/_store/timelineObservers.js @@ -2,7 +2,6 @@ import { updateInstanceInfo } from '../_actions/instances' import { createStream } from '../_actions/streaming' export function timelineObservers (store) { - let currentTimelineStream store.observe('currentTimeline', async (currentTimeline) => { diff --git a/routes/_utils/ajax.js b/routes/_utils/ajax.js index a081d46d..f7cf4d74 100644 --- a/routes/_utils/ajax.js +++ b/routes/_utils/ajax.js @@ -1,6 +1,6 @@ const TIMEOUT = 15000 -function fetchWithTimeout(url, options) { +function fetchWithTimeout (url, options) { return Promise.race([ fetch(url, options), new Promise((resolve, reject) => {