ソースを参照

Fix lint errors.

Lauri Ojansivu 5 年 前
コミット
8898862d36

+ 13 - 22
client/components/boards/boardBody.js

@@ -1,3 +1,5 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 const subManager = new SubsManager();
 const { calculateIndex, enableClickOnTouch } = Utils;
 const swimlaneWhileSortingHeight = 150;
@@ -192,9 +194,6 @@ BlazeComponent.extendComponent({
     // ugly touch event hotfix
     enableClickOnTouch('.js-swimlane:not(.placeholder)');
 
-    import { Cookies } from 'meteor/ostrio:cookies';
-    const cookies = new Cookies();
-
     this.autorun(() => {
       let showDesktopDragHandles = false;
       currentUser = Meteor.user();
@@ -207,8 +206,8 @@ BlazeComponent.extendComponent({
         showDesktopDragHandles = false;
       }
       if (
-        Utils.isMiniScreen()
-        || (!Utils.isMiniScreen() && showDesktopDragHandles)
+        Utils.isMiniScreen() ||
+        (!Utils.isMiniScreen() && showDesktopDragHandles)
       ) {
         $swimlanesDom.sortable({
           handle: '.js-swimlane-header-handle',
@@ -225,9 +224,9 @@ BlazeComponent.extendComponent({
 
     function userIsMember() {
       return (
-        Meteor.user()
-        && Meteor.user().isBoardMember()
-        && !Meteor.user().isCommentOnly()
+        Meteor.user() &&
+        Meteor.user().isBoardMember() &&
+        !Meteor.user().isCommentOnly()
       );
     }
 
@@ -244,8 +243,6 @@ BlazeComponent.extendComponent({
     if (currentUser) {
       return (currentUser.profile || {}).boardView === 'board-view-swimlanes';
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       return cookies.get('boardView') === 'board-view-swimlanes';
     }
   },
@@ -255,8 +252,6 @@ BlazeComponent.extendComponent({
     if (currentUser) {
       return (currentUser.profile || {}).boardView === 'board-view-lists';
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       return cookies.get('boardView') === 'board-view-lists';
     }
   },
@@ -266,8 +261,6 @@ BlazeComponent.extendComponent({
     if (currentUser) {
       return (currentUser.profile || {}).boardView === 'board-view-cal';
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       return cookies.get('boardView') === 'board-view-cal';
     }
   },
@@ -306,16 +299,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,
       });
   },
@@ -359,8 +352,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,
@@ -430,8 +423,6 @@ BlazeComponent.extendComponent({
     if (currentUser) {
       return (currentUser.profile || {}).boardView === 'board-view-cal';
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       return cookies.get('boardView') === 'board-view-cal';
     }
   },

+ 0 - 12
client/components/boards/boardHeader.js

@@ -175,15 +175,6 @@ Template.boardHeaderBar.helpers({
   boardView() {
     return Utils.boardView();
   },
-  //collapseSwimlane() {
-  //  import { Cookies } from 'meteor/ostrio:cookies';
-  //  const cookies = new Cookies();
-  //  if (cookies.has('collapseSwimlane')) {
-  //    return true;
-  //  } else {
-  //    return false;
-  //  }
-  //},
 });
 
 Template.boardChangeViewPopup.events({
@@ -195,9 +186,6 @@ Template.boardChangeViewPopup.events({
     Utils.setBoardView('board-view-swimlanes');
     Popup.close();
   },
-  //'click .js-open-collapse-view'() {
-  //  Utils.setBoardView('board-view-collapse');
-  //Popup.close();
   'click .js-open-cal-view'() {
     Utils.setBoardView('board-view-cal');
     Popup.close();

+ 2 - 6
client/components/cards/minicard.js

@@ -1,3 +1,5 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 // Template.cards.events({
 //   'click .member': Popup.open('cardMember')
 // });
@@ -18,8 +20,6 @@ BlazeComponent.extendComponent({
       },
       {
         'click .js-toggle-minicard-label-text'() {
-          import { Cookies } from 'meteor/ostrio:cookies';
-          const cookies = new Cookies();
           if (cookies.has('hiddenMinicardLabelText')) {
             cookies.remove('hiddenMinicardLabelText'); //true
           } else {
@@ -37,8 +37,6 @@ Template.minicard.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         return true;
       } else {
@@ -51,8 +49,6 @@ Template.minicard.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).hiddenMinicardLabelText;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('hiddenMinicardLabelText')) {
         return true;
       } else {

+ 10 - 13
client/components/lists/list.js

@@ -1,3 +1,5 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 const { calculateIndex, enableClickOnTouch } = Utils;
 
 BlazeComponent.extendComponent({
@@ -22,9 +24,9 @@ BlazeComponent.extendComponent({
 
     function userIsMember() {
       return (
-        Meteor.user()
-        && Meteor.user().isBoardMember()
-        && !Meteor.user().isCommentOnly()
+        Meteor.user() &&
+        Meteor.user().isBoardMember() &&
+        !Meteor.user().isCommentOnly()
       );
     }
 
@@ -74,14 +76,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;
 
@@ -115,9 +117,6 @@ BlazeComponent.extendComponent({
     // ugly touch event hotfix
     enableClickOnTouch(itemsSelector);
 
-    import { Cookies } from 'meteor/ostrio:cookies';
-    const cookies = new Cookies();
-
     this.autorun(() => {
       let showDesktopDragHandles = false;
       currentUser = Meteor.user();
@@ -178,8 +177,6 @@ Template.list.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         return true;
       } else {

+ 11 - 11
client/components/lists/listHeader.js

@@ -1,3 +1,5 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 let listsColors;
 Meteor.startup(() => {
   listsColors = Lists.simpleSchema()._schema.color.allowedValues;
@@ -7,9 +9,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()
     );
   },
 
@@ -66,8 +68,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()
     );
   },
 
@@ -108,8 +110,6 @@ Template.listHeader.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         return true;
       } else {
@@ -177,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());
     }
@@ -189,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());
     }

+ 2 - 4
client/components/sidebar/sidebar.js

@@ -1,3 +1,5 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 Sidebar = null;
 
 const defaultView = 'home';
@@ -111,8 +113,6 @@ BlazeComponent.extendComponent({
           if (currentUser) {
             Meteor.call('toggleMinicardLabelText');
           } else {
-            import { Cookies } from 'meteor/ostrio:cookies';
-            const cookies = new Cookies();
             if (cookies.has('hiddenMinicardLabelText')) {
               cookies.remove('hiddenMinicardLabelText');
             } else {
@@ -136,8 +136,6 @@ Template.homeSidebar.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).hiddenMinicardLabelText;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('hiddenMinicardLabelText')) {
         return true;
       } else {

+ 2 - 2
client/components/swimlanes/swimlaneHeader.js

@@ -1,3 +1,5 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 const { calculateIndexData } = Utils;
 
 let swimlaneColors;
@@ -34,8 +36,6 @@ Template.swimlaneHeader.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         return true;
       } else {

+ 22 - 28
client/components/swimlanes/swimlanes.js

@@ -1,10 +1,12 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
 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 +14,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,9 +92,9 @@ function initSortable(boardComponent, $listsDom) {
 
   function userIsMember() {
     return (
-      Meteor.user()
-      && Meteor.user().isBoardMember()
-      && !Meteor.user().isCommentOnly()
+      Meteor.user() &&
+      Meteor.user().isBoardMember() &&
+      !Meteor.user().isCommentOnly()
     );
   }
 
@@ -103,8 +105,6 @@ function initSortable(boardComponent, $listsDom) {
       showDesktopDragHandles = (currentUser.profile || {})
         .showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         showDesktopDragHandles = true;
       } else {
@@ -147,8 +147,6 @@ BlazeComponent.extendComponent({
 
     initSortable(boardComponent, $listsDom);
 
-    import { Cookies } from 'meteor/ostrio:cookies';
-    const cookies = new Cookies();
     if (cookies.has('collapseSwimlane')) {
       // Minimize swimlanes start https://www.w3schools.com/howto/howto_js_accordion.asp
       const acc = document.getElementsByClassName('accordion');
@@ -203,8 +201,6 @@ BlazeComponent.extendComponent({
             showDesktopDragHandles = (currentUser.profile || {})
               .showDesktopDragHandles;
           } else {
-            import { Cookies } from 'meteor/ostrio:cookies';
-            const cookies = new Cookies();
             if (cookies.has('showDesktopDragHandles')) {
               showDesktopDragHandles = true;
             } else {
@@ -213,15 +209,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;
@@ -255,8 +251,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();
   },
 
@@ -299,8 +295,6 @@ Template.swimlane.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         return true;
       } else {
@@ -310,9 +304,9 @@ Template.swimlane.helpers({
   },
   canSeeAddList() {
     return (
-      Meteor.user()
-      && Meteor.user().isBoardMember()
-      && !Meteor.user().isCommentOnly()
+      Meteor.user() &&
+      Meteor.user().isBoardMember() &&
+      !Meteor.user().isCommentOnly()
     );
   },
 });

+ 3 - 10
client/components/users/userHeader.js

@@ -1,3 +1,6 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
+
 Template.headerUserBar.events({
   'click .js-open-header-member-menu': Popup.open('memberMenu'),
   'click .js-change-avatar': Popup.open('changeAvatar'),
@@ -178,8 +181,6 @@ Template.changeSettingsPopup.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).showDesktopDragHandles;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         return true;
       } else {
@@ -192,8 +193,6 @@ Template.changeSettingsPopup.helpers({
     if (currentUser) {
       return (currentUser.profile || {}).hasHiddenSystemMessages;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('hasHiddenSystemMessages')) {
         return true;
       } else {
@@ -219,8 +218,6 @@ Template.changeSettingsPopup.events({
     if (currentUser) {
       Meteor.call('toggleDesktopDragHandles');
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('showDesktopDragHandles')) {
         cookies.remove('showDesktopDragHandles');
       } else {
@@ -233,8 +230,6 @@ Template.changeSettingsPopup.events({
     if (currentUser) {
       Meteor.call('toggleSystemMessages');
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.has('hasHiddenSystemMessages')) {
         cookies.remove('hasHiddenSystemMessages');
       } else {
@@ -253,8 +248,6 @@ Template.changeSettingsPopup.events({
       if (currentUser) {
         Meteor.call('changeLimitToShowCardsCount', minLimit);
       } else {
-        import { Cookies } from 'meteor/ostrio:cookies';
-        const cookies = new Cookies();
         cookies.set('limitToShowCardsCount', minLimit);
       }
       Popup.back();

+ 3 - 6
client/lib/utils.js

@@ -1,7 +1,8 @@
+import { Cookies } from 'meteor/ostrio:cookies';
+const cookies = new Cookies();
+
 Utils = {
   setBoardView(view) {
-    import { Cookies } from 'meteor/ostrio:cookies';
-    const cookies = new Cookies();
     currentUser = Meteor.user();
     if (currentUser) {
       Meteor.user().setBoardView(view);
@@ -18,8 +19,6 @@ Utils = {
   },
 
   unsetBoardView() {
-    import { Cookies } from 'meteor/ostrio:cookies';
-    const cookies = new Cookies();
     cookies.remove('boardView');
     cookies.remove('collapseSwimlane');
   },
@@ -29,8 +28,6 @@ Utils = {
     if (currentUser) {
       return (currentUser.profile || {}).boardView;
     } else {
-      import { Cookies } from 'meteor/ostrio:cookies';
-      const cookies = new Cookies();
       if (cookies.get('boardView') === 'board-view-lists') {
         return 'board-view-lists';
       } else if (