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

@ -55,7 +55,7 @@ const mutations = {
requireToken (state) {
state.strategy = TOKEN_STRATEGY
},
requireMFA (state, {app, settings}) {
requireMFA (state, { app, settings }) {
state.settings = settings
state.app = app
state.strategy = TOTP_STRATEGY // default strategy of MFA
@ -73,7 +73,8 @@ const mutations = {
// actions
const actions = {
async login ({state, dispatch, commit}, {access_token}) {
// eslint-disable-next-line camelcase
async login ({ state, dispatch, commit }, { access_token }) {
commit('setToken', access_token, { root: true })
await dispatch('loginUser', access_token, { root: true })
resetState(state)

View file

@ -1,7 +1,7 @@
const chat = {
state: {
messages: [],
channel: {state: ''},
channel: { state: '' },
socket: null
},
mutations: {
@ -29,7 +29,7 @@ const chat = {
channel.on('new_msg', (msg) => {
store.commit('addMessage', msg)
})
channel.on('messages', ({messages}) => {
channel.on('messages', ({ messages }) => {
store.commit('setMessages', messages)
})
channel.join()

View file

@ -56,10 +56,10 @@ const config = {
},
actions: {
setHighlight ({ commit, dispatch }, { user, color, type }) {
commit('setHighlight', {user, color, type})
commit('setHighlight', { user, color, type })
},
setOption ({ commit, dispatch }, { name, value }) {
commit('setOption', {name, value})
commit('setOption', { name, value })
switch (name) {
case 'theme':
setPreset(value, commit)

View file

@ -9,4 +9,3 @@ export function humanizeErrors (errors) {
return [...errs, message]
}, [])
}

View file

@ -74,7 +74,7 @@ const instance = {
},
actions: {
setInstanceOption ({ commit, dispatch }, { name, value }) {
commit('setInstanceOption', {name, value})
commit('setInstanceOption', { name, value })
switch (name) {
case 'name':
dispatch('setPageTitle')

View file

@ -3,12 +3,12 @@ const oauthTokens = {
tokens: []
},
actions: {
fetchTokens ({rootState, commit}) {
fetchTokens ({ rootState, commit }) {
rootState.api.backendInteractor.fetchOAuthTokens().then((tokens) => {
commit('swapTokens', tokens)
})
},
revokeToken ({rootState, commit, state}, id) {
revokeToken ({ rootState, commit, state }, id) {
rootState.api.backendInteractor.revokeOAuthToken(id).then((response) => {
if (response.status === 201) {
commit('swapTokens', state.tokens.filter(token => token.id !== id))

View file

@ -80,13 +80,13 @@ const mergeOrAdd = (arr, obj, item) => {
merge(oldItem, omitBy(item, (v, k) => v === null || k === 'user'))
// Reactivity fix.
oldItem.attachments.splice(oldItem.attachments.length)
return {item: oldItem, new: false}
return { item: oldItem, new: false }
} else {
// This is a new item, prepare it
prepareStatus(item)
arr.push(item)
set(obj, item.id, item)
return {item, new: true}
return { item, new: true }
}
}
@ -137,7 +137,7 @@ const removeStatusFromGlobalStorage = (state, status) => {
// TODO: Need to remove from allStatusesObject?
// Remove possible notification
remove(state.notifications.data, ({action: {id}}) => id === status.id)
remove(state.notifications.data, ({ action: { id } }) => id === status.id)
// Remove from conversation
const conversationId = status.statusnet_conversation_id
@ -270,7 +270,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
},
'deletion': (deletion) => {
const uri = deletion.uri
const status = find(allStatuses, {uri})
const status = find(allStatuses, { uri })
if (!status) {
return
}

View file

@ -347,8 +347,8 @@ const users = {
const notificationsObject = store.rootState.statuses.notifications.idStore
const relevantNotifications = Object.entries(notificationsObject)
.filter(([k, val]) => notificationIds.includes(k))
.map(([k, val]) => val)
.filter(([k, val]) => notificationIds.includes(k))
.map(([k, val]) => val)
// Reconnect users to notifications
each(relevantNotifications, (notification) => {
@ -394,7 +394,7 @@ const users = {
}
},
async getCaptcha (store) {
return await store.rootState.api.backendInteractor.getCaptcha()
return store.rootState.api.backendInteractor.getCaptcha()
},
logout (store) {
@ -472,19 +472,19 @@ const users = {
// Authentication failed
commit('endLogin')
if (response.status === 401) {
reject('Wrong username or password')
reject(new Error('Wrong username or password'))
} else {
reject('An error occurred, please try again')
reject(new Error('An error occurred, please try again'))
}
}
commit('endLogin')
resolve()
})
.catch((error) => {
console.log(error)
commit('endLogin')
reject('Failed to connect to server, try again')
})
.catch((error) => {
console.log(error)
commit('endLogin')
reject(new Error('Failed to connect to server, try again'))
})
})
}
}