Update eslint config

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-01-05 18:54:00 +01:00
parent 900afbbb6b
commit 6bbfe00474
37 changed files with 540 additions and 543 deletions

View File

@@ -27,7 +27,7 @@ const apiClient = new CardApi()
export default {
state: {
cards: []
cards: [],
},
getters: {
cardsByStack: state => (id) => {
@@ -35,73 +35,73 @@ export default {
},
cardById: state => (id) => {
return state.cards.find((card) => card.id === id)
}
},
},
mutations: {
clearCards(state) {
state.cards = []
},
addCard(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
let existingCard = state.cards.find(_card => _card.id === card.id)
const existingCard = state.cards.find(_card => _card.id === card.id)
Vue.set(state.cards, existingIndex, Object.assign({}, existingCard, card))
} else {
state.cards.push(card)
}
},
deleteCard(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
state.cards.splice(existingIndex, 1)
}
},
updateCard(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
Vue.set(state.cards, existingIndex, card)
}
},
updateTitle(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
state.cards[existingIndex].title = card.title
}
},
assignCardToUser(state, user) {
let existingIndex = state.cards.findIndex(_card => _card.id === user.cardId)
const existingIndex = state.cards.findIndex(_card => _card.id === user.cardId)
if (existingIndex !== -1) {
state.cards[existingIndex].assignedUsers.push(user)
}
},
removeUserFromCard(state, user) {
let existingIndex = state.cards.findIndex(_card => _card.id === user.cardId)
const existingIndex = state.cards.findIndex(_card => _card.id === user.cardId)
if (existingIndex !== -1) {
let foundIndex = state.cards[existingIndex].assignedUsers.findIndex(_user => _user.id === user.id)
const foundIndex = state.cards[existingIndex].assignedUsers.findIndex(_user => _user.id === user.id)
if (foundIndex !== -1) {
state.cards[existingIndex].assignedUsers.splice(foundIndex, 1)
}
}
},
updateCardDesc(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
state.cards[existingIndex].description = card.description
}
},
updateCardDue(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
state.cards[existingIndex].duedate = card.duedate
}
},
updateCardLabels(state, card) {
let existingIndex = state.cards.findIndex(_card => _card.id === card.id)
const existingIndex = state.cards.findIndex(_card => _card.id === card.id)
if (existingIndex !== -1) {
let existingCard = state.cards.find(_card => _card.id === card.id)
const existingCard = state.cards.find(_card => _card.id === card.id)
existingCard.labels = card.labels
}
}
},
},
actions: {
addCard({ commit }, card) {
@@ -192,6 +192,6 @@ export default {
.then((card) => {
commit('updateCardDue', card)
})
}
}
},
},
}

View File

@@ -37,13 +37,13 @@ const debug = process.env.NODE_ENV !== 'production'
export const BOARD_FILTERS = {
ALL: '',
ARCHIVED: 'archived',
SHARED: 'shared'
SHARED: 'shared',
}
export default new Vuex.Store({
modules: {
stack,
card
card,
},
strict: debug,
state: {
@@ -58,7 +58,7 @@ export default new Vuex.Store({
assignableUsers: [],
boardFilter: BOARD_FILTERS.ALL,
activity: [],
activityLoadMore: true
activityLoadMore: true,
},
getters: {
boards: state => {
@@ -93,7 +93,7 @@ export default new Vuex.Store({
},
currentBoardLabels: state => {
return state.currentBoard.labels
}
},
},
mutations: {
toggleShowArchived(state) {
@@ -197,7 +197,7 @@ export default new Vuex.Store({
},
updateLabelFromCurrentBoard(state, newLabel) {
let labelToUpdate = state.currentBoard.labels.find((l) => {
const labelToUpdate = state.currentBoard.labels.find((l) => {
return newLabel.id === l.id
})
@@ -214,7 +214,7 @@ export default new Vuex.Store({
state.currentBoard.acl.push(createdAcl)
},
updateAclFromCurrentBoard(state, acl) {
for (var acl_ in state.currentBoard.acl) {
for (const acl_ in state.currentBoard.acl) {
if (state.currentBoard.acl[acl_].participant.uid === acl.participant.uid) {
state.currentBoard.acl[acl_] = acl
break
@@ -223,8 +223,8 @@ export default new Vuex.Store({
},
deleteAclFromCurrentBoard(state, acl) {
let removeIndex = -1
for (var index in state.currentBoard.acl) {
var attr = state.currentBoard.acl[index]
for (const index in state.currentBoard.acl) {
const attr = state.currentBoard.acl[index]
if (acl.id === attr.id) {
removeIndex = index
break
@@ -234,7 +234,7 @@ export default new Vuex.Store({
if (removeIndex > -1) {
Vue.delete(state.currentBoard.acl, removeIndex)
}
}
},
},
actions: {
loadBoardById({ commit }, boardId) {
@@ -279,7 +279,7 @@ export default new Vuex.Store({
*
* @param commit
* @param board The board to update.
* @return {Promise<void>}
* @returns {Promise<void>}
*/
async updateBoard({ commit }, board) {
const storedBoard = await apiClient.updateBoard(board)
@@ -293,7 +293,7 @@ export default new Vuex.Store({
},
async cloneBoard({ commit }, boardData) {
try {
let newBoard = await apiClient.cloneBoard(boardData)
const newBoard = await apiClient.cloneBoard(boardData)
commit('cloneBoard', newBoard)
return newBoard
} catch (err) {
@@ -408,6 +408,6 @@ export default new Vuex.Store({
commit('deleteAclFromCurrentBoard', acl)
dispatch('loadBoardById', acl.boardId)
})
}
}
},
},
})

View File

@@ -30,39 +30,39 @@ export default {
state: {
stacks: [],
deletedStacks: [],
deletedCards: []
deletedCards: [],
},
getters: {
stacksByBoard: state => (id) => {
return state.stacks.filter((stack) => stack.boardId === id).sort((a, b) => a.order - b.order)
}
},
},
mutations: {
addStack(state, stack) {
let existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
const existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
if (existingIndex !== -1) {
let existingStack = state.stacks.find(_stack => _stack.id === stack.id)
const existingStack = state.stacks.find(_stack => _stack.id === stack.id)
Vue.set(state.stacks, existingIndex, Object.assign({}, existingStack, stack))
} else {
state.stacks.push(stack)
}
},
orderStack(state, { stack, removedIndex, addedIndex }) {
let currentOrder = state.stacks.filter((_stack) => _stack.boardId === stack.boardId).sort((a, b) => a.order - b.order)
var newOrder = applyOrderToArray(currentOrder, removedIndex, addedIndex)
const currentOrder = state.stacks.filter((_stack) => _stack.boardId === stack.boardId).sort((a, b) => a.order - b.order)
const newOrder = applyOrderToArray(currentOrder, removedIndex, addedIndex)
for (let i = 0; i < newOrder.length; i++) {
newOrder[i].order = parseInt(i)
}
},
deleteStack(state, stack) {
let existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
const existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
if (existingIndex !== -1) {
state.stacks.splice(existingIndex, 1)
}
},
updateStack(state, stack) {
let existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
const existingIndex = state.stacks.findIndex(_stack => _stack.id === stack.id)
if (existingIndex !== -1) {
state.stacks[existingIndex].title = stack.title
}
@@ -76,7 +76,7 @@ export default {
setDeletedCards(state, delCards) {
state.deletedCards = []
state.deletedCards = delCards
}
},
},
actions: {
orderStack({ commit }, { stack, removedIndex, addedIndex }) {
@@ -96,9 +96,9 @@ export default {
}
apiClient[call](boardId)
.then((stacks) => {
for (let i in stacks) {
let stack = stacks[i]
for (let j in stack.cards) {
for (const i in stacks) {
const stack = stacks[i]
for (const j in stack.cards) {
commit('addCard', stack.cards[j])
}
delete stack.cards
@@ -140,7 +140,7 @@ export default {
.then((stack) => {
commit('addStack', stack)
})
}
},
}
},
}