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-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-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-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", "URLSearchParams",
"IntersectionObserver", "IntersectionObserver",
"URL", "URL",
"Event",
"history",
"performance",
"self", "self",
"caches", "caches",
"__routes__", "__routes__",

View File

@ -1,6 +1,6 @@
import { get, paramsString } from '../_utils/ajax' 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` let url = `https://${instanceName}/api/v1/blocks`
url += '?' + paramsString({ limit }) url += '?' + paramsString({ limit })
return get(url, { return get(url, {
@ -8,7 +8,7 @@ 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` let url = `https://${instanceName}/api/v1/mutes`
url += '?' + paramsString({ limit }) url += '?' + paramsString({ limit })
return get(url, { return get(url, {

View File

@ -1,6 +1,6 @@
import { get, paramsString } from '../_utils/ajax' 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` let url = `https://${instanceName}/api/v1/accounts/${accountId}/statuses`
url += '?' + paramsString({ url += '?' + paramsString({
limit: 40, limit: 40,

View File

@ -1,6 +1,6 @@
import { get, paramsString } from '../_utils/ajax' 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` let url = `https://${instanceName}/api/v1/statuses/${statusId}/reblogged_by`
url += '?' + paramsString({ limit }) url += '?' + paramsString({ limit })
return get(url, { return get(url, {
@ -8,7 +8,7 @@ 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` let url = `https://${instanceName}/api/v1/statuses/${statusId}/favourited_by`
url += '?' + paramsString({ limit }) url += '?' + paramsString({ limit })
return get(url, { return get(url, {

View File

@ -29,7 +29,7 @@ function createKeyRangeForStatusThread (timeline) {
return IDBKeyRange.bound(start, end, true, true) return IDBKeyRange.bound(start, end, true, true)
} }
function cloneForStorage(obj) { function cloneForStorage (obj) {
let res = {} let res = {}
let keys = Object.keys(obj) let keys = Object.keys(obj)
for (let key of keys) { 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 // Status threads are a special case - these are in forward chronological order
// and we fetch them all at once instead of paginating. // and we fetch them all at once instead of paginating.
let isStatusThread = timeline.startsWith('status/') let isStatusThread = timeline.startsWith('status/')
let getReq = isStatusThread ? let getReq = isStatusThread
timelineStore.getAll(createKeyRangeForStatusThread(timeline)) : ? timelineStore.getAll(createKeyRangeForStatusThread(timeline))
timelineStore.getAll(createTimelineKeyRange(timeline, maxId), limit) : timelineStore.getAll(createTimelineKeyRange(timeline, maxId), limit)
getReq.onsuccess = e => { getReq.onsuccess = e => {
let timelineResults = e.target.result let timelineResults = e.target.result
@ -119,23 +119,23 @@ export async function getTimeline (instanceName, timeline, maxId = null, limit =
// insertion // insertion
// //
function putStatus(statusesStore, status) { function putStatus (statusesStore, status) {
statusesStore.put(cloneForStorage(status)) statusesStore.put(cloneForStorage(status))
} }
function putAccount(accountsStore, account) { function putAccount (accountsStore, account) {
accountsStore.put(cloneForStorage(account)) accountsStore.put(cloneForStorage(account))
} }
function putNotification(notificationsStore, notification) { function putNotification (notificationsStore, notification) {
notificationsStore.put(cloneForStorage(notification)) notificationsStore.put(cloneForStorage(notification))
} }
function storeAccount(accountsStore, account) { function storeAccount (accountsStore, account) {
putAccount(accountsStore, account) putAccount(accountsStore, account)
} }
function storeStatus(statusesStore, accountsStore, status) { function storeStatus (statusesStore, accountsStore, status) {
putStatus(statusesStore, status) putStatus(statusesStore, status)
putAccount(accountsStore, status.account) putAccount(accountsStore, status.account)
if (status.reblog) { 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) { if (notification.status) {
storeStatus(statusesStore, accountsStore, notification.status) storeStatus(statusesStore, accountsStore, notification.status)
} }
@ -152,13 +152,13 @@ function storeNotification(notificationsStore, statusesStore, accountsStore, not
putNotification(notificationsStore, notification) putNotification(notificationsStore, notification)
} }
function fetchAccount(accountsStore, id, callback) { function fetchAccount (accountsStore, id, callback) {
accountsStore.get(id).onsuccess = e => { accountsStore.get(id).onsuccess = e => {
callback(e.target.result) callback(e.target.result)
} }
} }
function fetchStatus(statusesStore, accountsStore, id, callback) { function fetchStatus (statusesStore, accountsStore, id, callback) {
statusesStore.get(id).onsuccess = e => { statusesStore.get(id).onsuccess = e => {
let status = e.target.result let status = e.target.result
callback(status) 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 => { notificationsStore.get(id).onsuccess = e => {
let notification = e.target.result let notification = e.target.result
callback(notification) callback(notification)

View File

@ -1,9 +1,8 @@
function computeForTimeline(store, key) { function computeForTimeline (store, key) {
store.compute(key, ['currentTimelineData'], (currentTimelineData) => currentTimelineData[key]) store.compute(key, ['currentTimelineData'], (currentTimelineData) => currentTimelineData[key])
} }
export function timelineComputations (store) { export function timelineComputations (store) {
store.compute('currentTimelineData', ['currentInstance', 'currentTimeline', 'timelines'], store.compute('currentTimelineData', ['currentInstance', 'currentTimeline', 'timelines'],
(currentInstance, currentTimeline, timelines) => { (currentInstance, currentTimeline, timelines) => {

View File

@ -8,7 +8,7 @@ if (process.browser && process.env.NODE_ENV !== 'production') {
window.delegateCallbacks = callbacks window.delegateCallbacks = callbacks
} }
function onEvent(e) { function onEvent (e) {
let { type, keyCode, target } = e let { type, keyCode, target } = e
if (!(type === 'click' || (type === 'keydown' && keyCode === 13))) { if (!(type === 'click' || (type === 'keydown' && keyCode === 13))) {
// we're not interested in any non-click or non-Enter events // we're not interested in any non-click or non-Enter events
@ -30,14 +30,14 @@ function onEvent(e) {
stop('delegate onEvent') stop('delegate onEvent')
} }
export function registerDelegate(type, key, callback) { export function registerDelegate (type, key, callback) {
mark('delegate registerDelegate') mark('delegate registerDelegate')
callbacks[type] = callbacks[type] || {} callbacks[type] = callbacks[type] || {}
callbacks[type][key] = callback callbacks[type][key] = callback
stop('delegate registerDelegate') stop('delegate registerDelegate')
} }
export function unregisterDelegate(type, key) { export function unregisterDelegate (type, key) {
mark('delegate unregisterDelegate') mark('delegate unregisterDelegate')
callbacks[type] = callbacks[type] || {} callbacks[type] = callbacks[type] || {}
delete callbacks[type][key] delete callbacks[type][key]

View File

@ -7,11 +7,11 @@ const enableMarks = process.browser &&
const perf = process.browser && performance const perf = process.browser && performance
function doMark(name) { function doMark (name) {
perf.mark(`start ${name}`) perf.mark(`start ${name}`)
} }
function doStop(name) { function doStop (name) {
perf.mark(`end ${name}`) perf.mark(`end ${name}`)
perf.measure(name, `start ${name}`, `end ${name}`) perf.measure(name, `start ${name}`, `end ${name}`)
} }