lint fixes

This commit is contained in:
Nolan Lawson 2018-02-11 09:37:13 -08:00
parent 9411490780
commit 5adc975bef
11 changed files with 34 additions and 32 deletions

View File

@ -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'}
]

View File

@ -78,6 +78,9 @@
"URLSearchParams",
"IntersectionObserver",
"URL",
"Event",
"history",
"performance",
"self",
"caches",
"__routes__",

View File

@ -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}`
})
}
}

View File

@ -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}`
})
}
}

View File

@ -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}`
})
}
}

View File

@ -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)

View File

@ -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) => {

View File

@ -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)
}
}

View File

@ -51,4 +51,4 @@ export function blurWithCapture (node, callback) {
node.removeEventListener('blur', callback, true)
}
}
}
}

View File

@ -15,4 +15,4 @@ function wrapper (type) {
if (process.browser) {
history.pushState = wrapper('pushState')
history.replaceState = wrapper('replaceState')
}
}

View File

@ -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}`)
}