From 788dd0a81a06efee165007a92780f9e8c2c754ac Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 20 Nov 2019 21:10:11 +0200 Subject: Fix lint errors. --- client/components/boards/boardBody.js | 30 ++++++++++------------ client/components/lists/list.js | 24 ++++++++--------- client/components/lists/listHeader.js | 20 ++++++++------- client/components/swimlanes/swimlanes.js | 44 +++++++++++++++----------------- client/lib/utils.js | 42 +++++++++++++++--------------- 5 files changed, 76 insertions(+), 84 deletions(-) (limited to 'client') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index b10f55ab..41b6f4ef 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -201,16 +201,14 @@ BlazeComponent.extendComponent({ if (currentUser) { showDesktopDragHandles = (currentUser.profile || {}) .showDesktopDragHandles; + } else if (cookies.has('showDesktopDragHandles')) { + showDesktopDragHandles = true; } else { - if (cookies.has('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } + showDesktopDragHandles = false; } if ( - Utils.isMiniScreen() || - (!Utils.isMiniScreen() && showDesktopDragHandles) + Utils.isMiniScreen() + || (!Utils.isMiniScreen() && showDesktopDragHandles) ) { $swimlanesDom.sortable({ handle: '.js-swimlane-header-handle', @@ -227,9 +225,9 @@ BlazeComponent.extendComponent({ function userIsMember() { return ( - Meteor.user() && - Meteor.user().isBoardMember() && - !Meteor.user().isCommentOnly() + Meteor.user() + && Meteor.user().isBoardMember() + && !Meteor.user().isCommentOnly() ); } @@ -308,16 +306,16 @@ BlazeComponent.extendComponent({ scrollLeft(position = 0) { const swimlanes = this.$('.js-swimlanes'); - swimlanes && - swimlanes.animate({ + swimlanes + && swimlanes.animate({ scrollLeft: position, }); }, scrollTop(position = 0) { const swimlanes = this.$('.js-swimlanes'); - swimlanes && - swimlanes.animate({ + swimlanes + && swimlanes.animate({ scrollTop: position, }); }, @@ -361,8 +359,8 @@ BlazeComponent.extendComponent({ end = end || card.endAt; title = title || card.title; const className = - (extraCls ? `${extraCls} ` : '') + - (card.color ? `calendar-event-${card.color}` : ''); + (extraCls ? `${extraCls} ` : '') + + (card.color ? `calendar-event-${card.color}` : ''); events.push({ id: card._id, title, diff --git a/client/components/lists/list.js b/client/components/lists/list.js index d97f4404..e58ea430 100644 --- a/client/components/lists/list.js +++ b/client/components/lists/list.js @@ -22,9 +22,9 @@ BlazeComponent.extendComponent({ function userIsMember() { return ( - Meteor.user() && - Meteor.user().isBoardMember() && - !Meteor.user().isCommentOnly() + Meteor.user() + && Meteor.user().isBoardMember() + && !Meteor.user().isCommentOnly() ); } @@ -74,14 +74,14 @@ BlazeComponent.extendComponent({ const currentBoard = Boards.findOne(Session.get('currentBoard')); let swimlaneId = ''; if ( - Utils.boardView() === 'board-view-swimlanes' || - currentBoard.isTemplatesBoard() + Utils.boardView() === 'board-view-swimlanes' + || currentBoard.isTemplatesBoard() ) swimlaneId = Blaze.getData(ui.item.parents('.swimlane').get(0))._id; else if ( - Utils.boardView() === 'board-view-lists' || - Utils.boardView() === 'board-view-cal' || - !Utils.boardView + Utils.boardView() === 'board-view-lists' + || Utils.boardView() === 'board-view-cal' + || !Utils.boardView ) swimlaneId = currentBoard.getDefaultSwimline()._id; @@ -124,12 +124,10 @@ BlazeComponent.extendComponent({ if (currentUser) { showDesktopDragHandles = (currentUser.profile || {}) .showDesktopDragHandles; + } else if (cookies.has('showDesktopDragHandles')) { + showDesktopDragHandles = true; } else { - if (cookies.has('showDesktopDragHandles')) { - showDesktopDragHandles = true; - } else { - showDesktopDragHandles = false; - } + showDesktopDragHandles = false; } if (!Utils.isMiniScreen() && showDesktopDragHandles) { diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index 4ef431fb..34322fa9 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -7,9 +7,9 @@ BlazeComponent.extendComponent({ canSeeAddCard() { const list = Template.currentData(); return ( - !list.getWipLimit('enabled') || - list.getWipLimit('soft') || - !this.reachedWipLimit() + !list.getWipLimit('enabled') + || list.getWipLimit('soft') + || !this.reachedWipLimit() ); }, @@ -47,6 +47,8 @@ BlazeComponent.extendComponent({ const currentUser = Meteor.user(); if (currentUser) { return Meteor.user().getLimitToShowCardsCount(); + } else { + return false; } }, @@ -64,8 +66,8 @@ BlazeComponent.extendComponent({ reachedWipLimit() { const list = Template.currentData(); return ( - list.getWipLimit('enabled') && - list.getWipLimit('value') <= list.cards().count() + list.getWipLimit('enabled') + && list.getWipLimit('value') <= list.cards().count() ); }, @@ -175,8 +177,8 @@ BlazeComponent.extendComponent({ const list = Template.currentData(); if ( - list.getWipLimit('soft') && - list.getWipLimit('value') < list.cards().count() + list.getWipLimit('soft') + && list.getWipLimit('value') < list.cards().count() ) { list.setWipLimit(list.cards().count()); } @@ -187,8 +189,8 @@ BlazeComponent.extendComponent({ const list = Template.currentData(); // Prevent user from using previously stored wipLimit.value if it is less than the current number of cards in the list if ( - !list.getWipLimit('enabled') && - list.getWipLimit('value') < list.cards().count() + !list.getWipLimit('enabled') + && list.getWipLimit('value') < list.cards().count() ) { list.setWipLimit(list.cards().count()); } diff --git a/client/components/swimlanes/swimlanes.js b/client/components/swimlanes/swimlanes.js index 8618373c..9bc093be 100644 --- a/client/components/swimlanes/swimlanes.js +++ b/client/components/swimlanes/swimlanes.js @@ -3,8 +3,8 @@ const { calculateIndex, enableClickOnTouch } = Utils; function currentListIsInThisSwimlane(swimlaneId) { const currentList = Lists.findOne(Session.get('currentList')); return ( - currentList && - (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '') + currentList + && (currentList.swimlaneId === swimlaneId || currentList.swimlaneId === '') ); } @@ -12,14 +12,14 @@ function currentCardIsInThisList(listId, swimlaneId) { const currentCard = Cards.findOne(Session.get('currentCard')); const currentUser = Meteor.user(); if ( - currentUser && - currentUser.profile && - Utils.boardView() === 'board-view-swimlanes' + currentUser + && currentUser.profile + && Utils.boardView() === 'board-view-swimlanes' ) return ( - currentCard && - currentCard.listId === listId && - currentCard.swimlaneId === swimlaneId + currentCard + && currentCard.listId === listId + && currentCard.swimlaneId === swimlaneId ); // Default view: board-view-lists else return currentCard && currentCard.listId === listId; @@ -90,15 +90,13 @@ function initSortable(boardComponent, $listsDom) { function userIsMember() { return ( - Meteor.user() && - Meteor.user().isBoardMember() && - !Meteor.user().isCommentOnly() + Meteor.user() + && Meteor.user().isBoardMember() + && !Meteor.user().isCommentOnly() ); } boardComponent.autorun(() => { - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); let showDesktopDragHandles = false; currentUser = Meteor.user(); if (currentUser) { @@ -199,8 +197,6 @@ BlazeComponent.extendComponent({ // the user will legitimately expect to be able to select some text with // his mouse. - import { Cookies } from 'meteor/ostrio:cookies'; - const cookies = new Cookies(); let showDesktopDragHandles = false; currentUser = Meteor.user(); if (currentUser) { @@ -217,15 +213,15 @@ BlazeComponent.extendComponent({ } const noDragInside = ['a', 'input', 'textarea', 'p'].concat( - Utils.isMiniScreen() || - (!Utils.isMiniScreen() && showDesktopDragHandles) + Utils.isMiniScreen() + || (!Utils.isMiniScreen() && showDesktopDragHandles) ? ['.js-list-handle', '.js-swimlane-header-handle'] : ['.js-list-header'], ); if ( - $(evt.target).closest(noDragInside.join(',')).length === 0 && - this.$('.swimlane').prop('clientHeight') > evt.offsetY + $(evt.target).closest(noDragInside.join(',')).length === 0 + && this.$('.swimlane').prop('clientHeight') > evt.offsetY ) { this._isDragging = true; this._lastDragPositionX = evt.clientX; @@ -259,8 +255,8 @@ BlazeComponent.extendComponent({ onCreated() { this.currentBoard = Boards.findOne(Session.get('currentBoard')); this.isListTemplatesSwimlane = - this.currentBoard.isTemplatesBoard() && - this.currentData().isListTemplatesSwimlane(); + this.currentBoard.isTemplatesBoard() + && this.currentData().isListTemplatesSwimlane(); this.currentSwimlane = this.currentData(); }, @@ -314,9 +310,9 @@ Template.swimlane.helpers({ }, canSeeAddList() { return ( - Meteor.user() && - Meteor.user().isBoardMember() && - !Meteor.user().isCommentOnly() + Meteor.user() + && Meteor.user().isBoardMember() + && !Meteor.user().isCommentOnly() ); }, }); diff --git a/client/lib/utils.js b/client/lib/utils.js index ab5e3597..c90dd749 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -5,17 +5,15 @@ Utils = { currentUser = Meteor.user(); if (currentUser) { Meteor.user().setBoardView(view); - } else { - if (view === 'board-view-lists') { - cookies.set('boardView', 'board-view-lists'); //true - } else if (view === 'board-view-swimlanes') { - cookies.set('boardView', 'board-view-swimlanes'); //true - //} else if (view === 'board-view-collapse') { - // cookies.set('boardView', 'board-view-swimlane'); //true - // cookies.set('collapseSwimlane', 'true'); //true - } else if (view === 'board-view-cal') { - cookies.set('boardView', 'board-view-cal'); //true - } + } else if (view === 'board-view-lists') { + cookies.set('boardView', 'board-view-lists'); //true + } else if (view === 'board-view-swimlanes') { + cookies.set('boardView', 'board-view-swimlanes'); //true + //} else if (view === 'board-view-collapse') { + // cookies.set('boardView', 'board-view-swimlane'); //true + // cookies.set('collapseSwimlane', 'true'); //true + } else if (view === 'board-view-cal') { + cookies.set('boardView', 'board-view-cal'); //true } }, @@ -54,8 +52,8 @@ Utils = { goBoardId(_id) { const board = Boards.findOne(_id); return ( - board && - FlowRouter.go('board', { + board + && FlowRouter.go('board', { id: board._id, slug: board.slug, }) @@ -66,8 +64,8 @@ Utils = { const card = Cards.findOne(_id); const board = Boards.findOne(card.boardId); return ( - board && - FlowRouter.go('card', { + board + && FlowRouter.go('card', { cardId: card._id, boardId: board._id, slug: board.slug, @@ -238,8 +236,8 @@ Utils = { }; if ( - 'ontouchstart' in window || - (window.DocumentTouch && document instanceof window.DocumentTouch) + 'ontouchstart' in window + || (window.DocumentTouch && document instanceof window.DocumentTouch) ) { return true; } @@ -260,8 +258,8 @@ Utils = { calculateTouchDistance(touchA, touchB) { return Math.sqrt( - Math.pow(touchA.screenX - touchB.screenX, 2) + - Math.pow(touchA.screenY - touchB.screenY, 2), + Math.pow(touchA.screenX - touchB.screenX, 2) + + Math.pow(touchA.screenY - touchB.screenY, 2), ); }, @@ -278,9 +276,9 @@ Utils = { }); $(document).on('touchend', selector, function(e) { if ( - touchStart && - lastTouch && - Utils.calculateTouchDistance(touchStart, lastTouch) <= 20 + touchStart + && lastTouch + && Utils.calculateTouchDistance(touchStart, lastTouch) <= 20 ) { e.preventDefault(); const clickEvent = document.createEvent('MouseEvents'); -- cgit v1.2.3-1-g7c22