Merge branch 'eslint-fix' into 'develop'

Fix shitton warning eslint gives

See merge request pleroma/pleroma-fe!871
This commit is contained in:
Shpuld Shpludson 2019-07-07 19:12:33 +00:00
commit 54b0f90133
145 changed files with 5313 additions and 2617 deletions

View file

@ -315,7 +315,7 @@ const exportFriends = ({ id, credentials }) => {
let more = true
while (more) {
const maxId = friends.length > 0 ? last(friends).id : undefined
const users = await fetchFriends({id, maxId, credentials})
const users = await fetchFriends({ id, maxId, credentials })
friends = concat(friends, users)
if (users.length === 0) {
more = false

View file

@ -63,26 +63,32 @@ const backendInteractorService = credentials => {
return notificationsFetcher.startFetching({ store, credentials })
}
// eslint-disable-next-line camelcase
const tagUser = ({ screen_name }, tag) => {
return apiService.tagUser({ screen_name, tag, credentials })
}
// eslint-disable-next-line camelcase
const untagUser = ({ screen_name }, tag) => {
return apiService.untagUser({ screen_name, tag, credentials })
}
// eslint-disable-next-line camelcase
const addRight = ({ screen_name }, right) => {
return apiService.addRight({ screen_name, right, credentials })
}
// eslint-disable-next-line camelcase
const deleteRight = ({ screen_name }, right) => {
return apiService.deleteRight({ screen_name, right, credentials })
}
// eslint-disable-next-line camelcase
const setActivationStatus = ({ screen_name }, status) => {
return apiService.setActivationStatus({ screen_name, status, credentials })
}
// eslint-disable-next-line camelcase
const deleteUser = ({ screen_name }) => {
return apiService.deleteUser({ screen_name, credentials })
}

View file

@ -59,7 +59,7 @@ const srgbToLinear = (srgb) => {
* @returns {Number} relative luminance
*/
const relativeLuminance = (srgb) => {
const {r, g, b} = srgbToLinear(srgb)
const { r, g, b } = srgbToLinear(srgb)
return 0.2126 * r + 0.7152 * g + 0.0722 * b
}

View file

@ -8,7 +8,7 @@ export const wordAtPosition = (str, pos) => {
const words = splitIntoWords(str)
const wordsWithPosition = addPositionToWords(words)
return find(wordsWithPosition, ({start, end}) => start <= pos && end > pos)
return find(wordsWithPosition, ({ start, end }) => start <= pos && end > pos)
}
export const addPositionToWords = (words) => {

View file

@ -9,7 +9,7 @@ const fileSizeFormat = (num) => {
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1)
num = (num / Math.pow(1024, exponent)).toFixed(2) * 1
unit = units[exponent]
return {num: num, unit: unit}
return { num: num, unit: unit }
}
const fileSizeFormatService = {
fileSizeFormat

View file

@ -8,7 +8,7 @@ const fetchAndUpdate = ({ store, credentials }) => {
.catch(() => {})
}
const startFetching = ({credentials, store}) => {
const startFetching = ({ credentials, store }) => {
fetchAndUpdate({ credentials, store })
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
return setInterval(boundFetchAndUpdate, 10000)

View file

@ -1,4 +1,4 @@
const verifyOTPCode = ({app, instance, mfaToken, code}) => {
const verifyOTPCode = ({ app, instance, mfaToken, code }) => {
const url = `${instance}/oauth/mfa/challenge`
const form = new window.FormData()
@ -14,7 +14,7 @@ const verifyOTPCode = ({app, instance, mfaToken, code}) => {
}).then((data) => data.json())
}
const verifyRecoveryCode = ({app, instance, mfaToken, code}) => {
const verifyRecoveryCode = ({ app, instance, mfaToken, code }) => {
const url = `${instance}/oauth/mfa/challenge`
const form = new window.FormData()

View file

@ -93,7 +93,7 @@ export const getClientToken = ({ clientId, clientSecret, instance }) => {
body: form
}).then((data) => data.json())
}
const verifyOTPCode = ({app, instance, mfaToken, code}) => {
const verifyOTPCode = ({ app, instance, mfaToken, code }) => {
const url = `${instance}/oauth/mfa/challenge`
const form = new window.FormData()
@ -109,7 +109,7 @@ const verifyOTPCode = ({app, instance, mfaToken, code}) => {
}).then((data) => data.json())
}
const verifyRecoveryCode = ({app, instance, mfaToken, code}) => {
const verifyRecoveryCode = ({ app, instance, mfaToken, code }) => {
const url = `${instance}/oauth/mfa/challenge`
const form = new window.FormData()

View file

@ -1,7 +1,7 @@
import utils from './utils.js'
import { parseUser } from '../entity_normalizer/entity_normalizer.service.js'
const search = ({query, store}) => {
const search = ({ query, store }) => {
return utils.request({
store,
url: '/api/v1/accounts/search',
@ -10,8 +10,8 @@ const search = ({query, store}) => {
resolve: true
}
})
.then((data) => data.json())
.then((data) => data.map(parseUser))
.then((data) => data.json())
.then((data) => data.map(parseUser))
}
const UserSearch = {
search

View file

@ -13,7 +13,7 @@ const headers = (store) => {
}
}
const request = ({method = 'GET', url, params, store}) => {
const request = ({ method = 'GET', url, params, store }) => {
const instance = store.state.instance.server
let fullUrl = `${instance}${url}`

View file

@ -35,4 +35,4 @@ export const visibleNotificationsFromStore = (store, types) => {
}
export const unseenNotificationsFromStore = store =>
filter(visibleNotificationsFromStore(store), ({seen}) => !seen)
filter(visibleNotificationsFromStore(store), ({ seen }) => !seen)

View file

@ -1,12 +1,12 @@
import apiService from '../api/api.service.js'
const update = ({store, notifications, older}) => {
const update = ({ store, notifications, older }) => {
store.dispatch('setNotificationsError', { value: false })
store.dispatch('addNewNotifications', { notifications, older })
}
const fetchAndUpdate = ({store, credentials, older = false}) => {
const fetchAndUpdate = ({ store, credentials, older = false }) => {
const args = { credentials }
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.notifications
@ -45,7 +45,7 @@ const fetchNotifications = ({ store, args, older }) => {
.catch(() => store.dispatch('setNotificationsError', { value: true }))
}
const startFetching = ({credentials, store}) => {
const startFetching = ({ credentials, store }) => {
fetchAndUpdate({ credentials, store })
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
// Initially there's set flag to silence all desktop notifications so

View file

@ -13,7 +13,7 @@ const postStatus = ({ store, status, spoilerText, visibility, sensitive, poll, m
mediaIds,
inReplyToStatusId,
contentType,
poll})
poll })
.then((data) => {
if (!data.error) {
store.dispatch('addNewStatuses', {

View file

@ -239,12 +239,12 @@ const generateColors = (input) => {
})
const htmlColors = Object.entries(colors)
.reduce((acc, [k, v]) => {
if (!v) return acc
acc.solid[k] = rgb2hex(v)
acc.complete[k] = typeof v.a === 'undefined' ? rgb2hex(v) : rgb2rgba(v)
return acc
}, { complete: {}, solid: {} })
.reduce((acc, [k, v]) => {
if (!v) return acc
acc.solid[k] = rgb2hex(v)
acc.complete[k] = typeof v.a === 'undefined' ? rgb2hex(v) : rgb2rgba(v)
return acc
}, { complete: {}, solid: {} })
return {
rules: {
colors: Object.entries(htmlColors.complete)

View file

@ -2,7 +2,7 @@ import { camelCase } from 'lodash'
import apiService from '../api/api.service.js'
const update = ({store, statuses, timeline, showImmediately, userId}) => {
const update = ({ store, statuses, timeline, showImmediately, userId }) => {
const ccTimeline = camelCase(timeline)
store.dispatch('setError', { value: false })
@ -15,7 +15,7 @@ const update = ({store, statuses, timeline, showImmediately, userId}) => {
})
}
const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false, until}) => {
const fetchAndUpdate = ({ store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false, until }) => {
const args = { timeline, credentials }
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
@ -40,17 +40,17 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
update({store, statuses, timeline, showImmediately, userId})
update({ store, statuses, timeline, showImmediately, userId })
return statuses
}, () => store.dispatch('setError', { value: true }))
}
const startFetching = ({timeline = 'friends', credentials, store, userId = false, tag = false}) => {
const startFetching = ({ timeline = 'friends', credentials, store, userId = false, tag = false }) => {
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
const showImmediately = timelineData.visibleStatuses.length === 0
timelineData.userId = userId
fetchAndUpdate({timeline, credentials, store, showImmediately, userId, tag})
fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, tag })
const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId, tag })
return setInterval(boundFetchAndUpdate, 10000)
}

View file

@ -1,7 +1,7 @@
import { hex2rgb } from '../color_convert/color_convert.js'
const highlightStyle = (prefs) => {
if (prefs === undefined) return
const {color, type} = prefs
const { color, type } = prefs
if (typeof color !== 'string') return
const rgb = hex2rgb(color)
if (rgb == null) return