From 5adc975bef4962acbde8471eb09421989e27f363 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Feb 2018 09:37:13 -0800 Subject: [PATCH] lint fixes --- bin/svgs.js | 2 +- package.json | 3 +++ routes/_api/blockedAndMuted.js | 6 +++--- routes/_api/pinnedStatuses.js | 4 ++-- routes/_api/reblogsAndFavs.js | 6 +++--- routes/_database/timelines.js | 26 +++++++++++++------------- routes/_store/timelineComputations.js | 3 +-- routes/_utils/delegate.js | 8 ++++---- routes/_utils/events.js | 2 +- routes/_utils/historyEvents.js | 2 +- routes/_utils/marks.js | 4 ++-- 11 files changed, 34 insertions(+), 32 deletions(-) diff --git a/bin/svgs.js b/bin/svgs.js index 8ca2e06..87e1254 100644 --- a/bin/svgs.js +++ b/bin/svgs.js @@ -24,5 +24,5 @@ module.exports = [ {id: 'fa-thumb-tack', src: 'node_modules/font-awesome-svg-png/white/svg/thumb-tack.svg', title: 'Thumbtack'}, {id: 'fa-bars', src: 'node_modules/font-awesome-svg-png/white/svg/bars.svg', title: 'List'}, {id: 'fa-volume-off', src: 'node_modules/font-awesome-svg-png/white/svg/volume-off.svg', title: 'Volume off'}, - {id: 'fa-ban', src: 'node_modules/font-awesome-svg-png/white/svg/ban.svg', title: 'Ban'}, + {id: 'fa-ban', src: 'node_modules/font-awesome-svg-png/white/svg/ban.svg', title: 'Ban'} ] diff --git a/package.json b/package.json index 35459d3..14e08c3 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,9 @@ "URLSearchParams", "IntersectionObserver", "URL", + "Event", + "history", + "performance", "self", "caches", "__routes__", diff --git a/routes/_api/blockedAndMuted.js b/routes/_api/blockedAndMuted.js index da0b270..4884cf3 100644 --- a/routes/_api/blockedAndMuted.js +++ b/routes/_api/blockedAndMuted.js @@ -1,6 +1,6 @@ import { get, paramsString } from '../_utils/ajax' -export async function getBlockedAccounts(instanceName, accessToken, limit = 80) { +export async function getBlockedAccounts (instanceName, accessToken, limit = 80) { let url = `https://${instanceName}/api/v1/blocks` url += '?' + paramsString({ limit }) return get(url, { @@ -8,10 +8,10 @@ export async function getBlockedAccounts(instanceName, accessToken, limit = 80) }) } -export async function getMutedAccounts(instanceName, accessToken, limit = 80) { +export async function getMutedAccounts (instanceName, accessToken, limit = 80) { let url = `https://${instanceName}/api/v1/mutes` url += '?' + paramsString({ limit }) return get(url, { 'Authorization': `Bearer ${accessToken}` }) -} \ No newline at end of file +} diff --git a/routes/_api/pinnedStatuses.js b/routes/_api/pinnedStatuses.js index e8c6854..531fd1f 100644 --- a/routes/_api/pinnedStatuses.js +++ b/routes/_api/pinnedStatuses.js @@ -1,6 +1,6 @@ import { get, paramsString } from '../_utils/ajax' -export async function getPinnedStatuses(instanceName, accessToken, accountId) { +export async function getPinnedStatuses (instanceName, accessToken, accountId) { let url = `https://${instanceName}/api/v1/accounts/${accountId}/statuses` url += '?' + paramsString({ limit: 40, @@ -9,4 +9,4 @@ export async function getPinnedStatuses(instanceName, accessToken, accountId) { return get(url, { 'Authorization': `Bearer ${accessToken}` }) -} \ No newline at end of file +} diff --git a/routes/_api/reblogsAndFavs.js b/routes/_api/reblogsAndFavs.js index a6d1a53..e44156a 100644 --- a/routes/_api/reblogsAndFavs.js +++ b/routes/_api/reblogsAndFavs.js @@ -1,6 +1,6 @@ import { get, paramsString } from '../_utils/ajax' -export async function getReblogs(instanceName, accessToken, statusId, limit = 80) { +export async function getReblogs (instanceName, accessToken, statusId, limit = 80) { let url = `https://${instanceName}/api/v1/statuses/${statusId}/reblogged_by` url += '?' + paramsString({ limit }) return get(url, { @@ -8,10 +8,10 @@ export async function getReblogs(instanceName, accessToken, statusId, limit = 80 }) } -export async function getFavorites(instanceName, accessToken, statusId, limit = 80) { +export async function getFavorites (instanceName, accessToken, statusId, limit = 80) { let url = `https://${instanceName}/api/v1/statuses/${statusId}/favourited_by` url += '?' + paramsString({ limit }) return get(url, { 'Authorization': `Bearer ${accessToken}` }) -} \ No newline at end of file +} diff --git a/routes/_database/timelines.js b/routes/_database/timelines.js index 99b3a62..0a18a15 100644 --- a/routes/_database/timelines.js +++ b/routes/_database/timelines.js @@ -29,7 +29,7 @@ function createKeyRangeForStatusThread (timeline) { return IDBKeyRange.bound(start, end, true, true) } -function cloneForStorage(obj) { +function cloneForStorage (obj) { let res = {} let keys = Object.keys(obj) for (let key of keys) { @@ -89,9 +89,9 @@ async function getStatusTimeline (instanceName, timeline, maxId, limit) { // Status threads are a special case - these are in forward chronological order // and we fetch them all at once instead of paginating. let isStatusThread = timeline.startsWith('status/') - let getReq = isStatusThread ? - timelineStore.getAll(createKeyRangeForStatusThread(timeline)) : - timelineStore.getAll(createTimelineKeyRange(timeline, maxId), limit) + let getReq = isStatusThread + ? timelineStore.getAll(createKeyRangeForStatusThread(timeline)) + : timelineStore.getAll(createTimelineKeyRange(timeline, maxId), limit) getReq.onsuccess = e => { let timelineResults = e.target.result @@ -119,23 +119,23 @@ export async function getTimeline (instanceName, timeline, maxId = null, limit = // insertion // -function putStatus(statusesStore, status) { +function putStatus (statusesStore, status) { statusesStore.put(cloneForStorage(status)) } -function putAccount(accountsStore, account) { +function putAccount (accountsStore, account) { accountsStore.put(cloneForStorage(account)) } -function putNotification(notificationsStore, notification) { +function putNotification (notificationsStore, notification) { notificationsStore.put(cloneForStorage(notification)) } -function storeAccount(accountsStore, account) { +function storeAccount (accountsStore, account) { putAccount(accountsStore, account) } -function storeStatus(statusesStore, accountsStore, status) { +function storeStatus (statusesStore, accountsStore, status) { putStatus(statusesStore, status) putAccount(accountsStore, status.account) if (status.reblog) { @@ -144,7 +144,7 @@ function storeStatus(statusesStore, accountsStore, status) { } } -function storeNotification(notificationsStore, statusesStore, accountsStore, notification) { +function storeNotification (notificationsStore, statusesStore, accountsStore, notification) { if (notification.status) { storeStatus(statusesStore, accountsStore, notification.status) } @@ -152,13 +152,13 @@ function storeNotification(notificationsStore, statusesStore, accountsStore, not putNotification(notificationsStore, notification) } -function fetchAccount(accountsStore, id, callback) { +function fetchAccount (accountsStore, id, callback) { accountsStore.get(id).onsuccess = e => { callback(e.target.result) } } -function fetchStatus(statusesStore, accountsStore, id, callback) { +function fetchStatus (statusesStore, accountsStore, id, callback) { statusesStore.get(id).onsuccess = e => { let status = e.target.result callback(status) @@ -173,7 +173,7 @@ function fetchStatus(statusesStore, accountsStore, id, callback) { } } -function fetchNotification(notificationsStore, statusesStore, accountsStore, id, callback) { +function fetchNotification (notificationsStore, statusesStore, accountsStore, id, callback) { notificationsStore.get(id).onsuccess = e => { let notification = e.target.result callback(notification) diff --git a/routes/_store/timelineComputations.js b/routes/_store/timelineComputations.js index a4c9e64..68310fc 100644 --- a/routes/_store/timelineComputations.js +++ b/routes/_store/timelineComputations.js @@ -1,9 +1,8 @@ -function computeForTimeline(store, key) { +function computeForTimeline (store, key) { store.compute(key, ['currentTimelineData'], (currentTimelineData) => currentTimelineData[key]) } - export function timelineComputations (store) { store.compute('currentTimelineData', ['currentInstance', 'currentTimeline', 'timelines'], (currentInstance, currentTimeline, timelines) => { diff --git a/routes/_utils/delegate.js b/routes/_utils/delegate.js index d12d233..ddcef92 100644 --- a/routes/_utils/delegate.js +++ b/routes/_utils/delegate.js @@ -8,7 +8,7 @@ if (process.browser && process.env.NODE_ENV !== 'production') { window.delegateCallbacks = callbacks } -function onEvent(e) { +function onEvent (e) { let { type, keyCode, target } = e if (!(type === 'click' || (type === 'keydown' && keyCode === 13))) { // we're not interested in any non-click or non-Enter events @@ -30,14 +30,14 @@ function onEvent(e) { stop('delegate onEvent') } -export function registerDelegate(type, key, callback) { +export function registerDelegate (type, key, callback) { mark('delegate registerDelegate') callbacks[type] = callbacks[type] || {} callbacks[type][key] = callback stop('delegate registerDelegate') } -export function unregisterDelegate(type, key) { +export function unregisterDelegate (type, key) { mark('delegate unregisterDelegate') callbacks[type] = callbacks[type] || {} delete callbacks[type][key] @@ -47,4 +47,4 @@ export function unregisterDelegate(type, key) { if (process.browser) { document.addEventListener('click', onEvent) document.addEventListener('keydown', onEvent) -} \ No newline at end of file +} diff --git a/routes/_utils/events.js b/routes/_utils/events.js index 1b02ba5..e0089f5 100644 --- a/routes/_utils/events.js +++ b/routes/_utils/events.js @@ -51,4 +51,4 @@ export function blurWithCapture (node, callback) { node.removeEventListener('blur', callback, true) } } -} \ No newline at end of file +} diff --git a/routes/_utils/historyEvents.js b/routes/_utils/historyEvents.js index 6f40b28..ad5a153 100644 --- a/routes/_utils/historyEvents.js +++ b/routes/_utils/historyEvents.js @@ -15,4 +15,4 @@ function wrapper (type) { if (process.browser) { history.pushState = wrapper('pushState') history.replaceState = wrapper('replaceState') -} \ No newline at end of file +} diff --git a/routes/_utils/marks.js b/routes/_utils/marks.js index f354db6..83a4527 100644 --- a/routes/_utils/marks.js +++ b/routes/_utils/marks.js @@ -7,11 +7,11 @@ const enableMarks = process.browser && const perf = process.browser && performance -function doMark(name) { +function doMark (name) { perf.mark(`start ${name}`) } -function doStop(name) { +function doStop (name) { perf.mark(`end ${name}`) perf.measure(name, `start ${name}`, `end ${name}`) }