Browse Source

Fix lint errors

Andrés Manelli 6 years ago
parent
commit
eb62c9ce6a

+ 2 - 2
client/components/boards/boardsList.js

@@ -8,10 +8,10 @@ Template.boardListHeaderBar.events({
 
 Template.boardListHeaderBar.helpers({
   templatesBoardId() {
-      return Meteor.user().getTemplatesBoardId();
+    return Meteor.user().getTemplatesBoardId();
   },
   templatesBoardSlug() {
-      return Meteor.user().getTemplatesBoardSlug();
+    return Meteor.user().getTemplatesBoardSlug();
   },
 });
 

+ 40 - 40
client/components/lists/listBody.js

@@ -81,16 +81,16 @@ BlazeComponent.extendComponent({
           cardType = 'template-card';
         // If this is the board templates swimlane, insert a board template and a linked card
         else if (swimlane.isBoardTemplatesSwimlane()) {
-            linkedId = Boards.insert({
-                title,
-                permission: 'private',
-                type: 'template-board',
-            });
-            Swimlanes.insert({
-                title: TAPi18n.__('default'),
-                boardId: linkedId,
-            });
-            cardType = 'cardType-linkedBoard';
+          linkedId = Boards.insert({
+            title,
+            permission: 'private',
+            type: 'template-board',
+          });
+          Swimlanes.insert({
+            title: TAPi18n.__('default'),
+            boardId: linkedId,
+          });
+          cardType = 'cardType-linkedBoard';
         }
       } else if (boardView === 'board-view-swimlanes')
         swimlaneId = this.parentComponent().parentComponent().data()._id;
@@ -149,9 +149,9 @@ BlazeComponent.extendComponent({
       const methodName = evt.shiftKey ? 'toggleRange' : 'toggle';
       MultiSelection[methodName](this.currentData()._id);
 
-    // If the card is already selected, we want to de-select it.
-    // XXX We should probably modify the minicard href attribute instead of
-    // overwriting the event in case the card is already selected.
+      // If the card is already selected, we want to de-select it.
+      // XXX We should probably modify the minicard href attribute instead of
+      // overwriting the event in case the card is already selected.
     } else if (Session.equals('currentCard', this.currentData()._id)) {
       evt.stopImmediatePropagation();
       evt.preventDefault();
@@ -171,8 +171,8 @@ BlazeComponent.extendComponent({
 
   idOrNull(swimlaneId) {
     const currentUser = Meteor.user();
-    if (currentUser.profile.boardView === 'board-view-swimlanes'
-        || this.data().board().isTemplatesBoard())
+    if (currentUser.profile.boardView === 'board-view-swimlanes' ||
+        this.data().board().isTemplatesBoard())
       return swimlaneId;
     return undefined;
   },
@@ -292,8 +292,8 @@ BlazeComponent.extendComponent({
       // work.
       $form.find('button[type=submit]').click();
 
-    // Pressing Tab should open the form of the next column, and Maj+Tab go
-    // in the reverse order
+      // Pressing Tab should open the form of the next column, and Maj+Tab go
+      // in the reverse order
     } else if (evt.keyCode === 9) {
       evt.preventDefault();
       const isReverse = evt.shiftKey;
@@ -354,7 +354,7 @@ BlazeComponent.extendComponent({
           const currentBoard = Boards.findOne(Session.get('currentBoard'));
           callback($.map(currentBoard.labels, (label) => {
             if (label.name.indexOf(term) > -1 ||
-                label.color.indexOf(term) > -1) {
+              label.color.indexOf(term) > -1) {
               return label;
             }
             return null;
@@ -530,7 +530,7 @@ BlazeComponent.extendComponent({
     this.isTemplateSearch = this.isCardTemplateSearch || this.isListTemplateSearch || this.isSwimlaneTemplateSearch;
     let board = {};
     if (this.isTemplateSearch) {
-        board = Boards.findOne(Meteor.user().profile.templatesBoardId);
+      board = Boards.findOne(Meteor.user().profile.templatesBoardId);
     } else {
       // Prefetch first non-current board id
       board = Boards.findOne({
@@ -582,13 +582,13 @@ BlazeComponent.extendComponent({
     }
     const board = Boards.findOne(this.selectedBoardId.get());
     if (!this.isTemplateSearch || this.isCardTemplateSearch) {
-        return board.searchCards(this.term.get(), false);
+      return board.searchCards(this.term.get(), false);
     } else if (this.isListTemplateSearch) {
-        return board.searchLists(this.term.get());
+      return board.searchLists(this.term.get());
     } else if (this.isSwimlaneTemplateSearch) {
-        return board.searchSwimlanes(this.term.get());
+      return board.searchSwimlanes(this.term.get());
     } else {
-        return [];
+      return [];
     }
   },
 
@@ -604,7 +604,7 @@ BlazeComponent.extendComponent({
       },
       'click .js-minicard'(evt) {
         // 0. Common
-        let element = Blaze.getData(evt.currentTarget);
+        const element = Blaze.getData(evt.currentTarget);
         element.boardId = this.boardId;
         let _id = '';
         if (!this.isTemplateSearch || this.isCardTemplateSearch) {
@@ -615,27 +615,27 @@ BlazeComponent.extendComponent({
           element.sort = Lists.findOne(this.listId).cards().count();
           // 1.A From template
           if (this.isTemplateSearch) {
-              element.type = 'cardType-card';
-              element.linkedId = '';
-              _id = element.copy();
-          // 1.B Linked card
+            element.type = 'cardType-card';
+            element.linkedId = '';
+            _id = element.copy();
+            // 1.B Linked card
           } else {
-              element._id = null;
-              element.type = 'cardType-linkedCard';
-              element.linkedId = element.linkedId || element._id;
-              _id = Cards.insert(element);
+            element._id = null;
+            element.type = 'cardType-linkedCard';
+            element.linkedId = element.linkedId || element._id;
+            _id = Cards.insert(element);
           }
           Filter.addException(_id);
-        // List insertion
+          // List insertion
         } else if (this.isListTemplateSearch) {
-            element.sort = Swimlanes.findOne(this.swimlaneId).lists().count();
-            element.type = 'list';
-            element.swimlaneId = this.swimlaneId;
-            _id = element.copy();
+          element.sort = Swimlanes.findOne(this.swimlaneId).lists().count();
+          element.type = 'list';
+          element.swimlaneId = this.swimlaneId;
+          _id = element.copy();
         } else if (this.isSwimlaneTemplateSearch) {
-            element.sort = Boards.findOne(this.boardId).swimlanes().count();
-            element.type = 'swimlalne';
-            _id = element.copy();
+          element.sort = Boards.findOne(this.boardId).swimlanes().count();
+          element.type = 'swimlalne';
+          _id = element.copy();
         }
         Popup.close();
       },

+ 2 - 2
client/components/users/userHeader.js

@@ -5,10 +5,10 @@ Template.headerUserBar.events({
 
 Template.memberMenuPopup.helpers({
   templatesBoardId() {
-      return Meteor.user().getTemplatesBoardId();
+    return Meteor.user().getTemplatesBoardId();
   },
   templatesBoardSlug() {
-      return Meteor.user().getTemplatesBoardSlug();
+    return Meteor.user().getTemplatesBoardSlug();
   },
 });
 

+ 6 - 6
models/boards.js

@@ -471,7 +471,7 @@ Boards.helpers({
       query.type = 'template-swimlane';
       query.archived = false;
     } else {
-        query.type = {$nin: ['template-swimlane']};
+      query.type = {$nin: ['template-swimlane']};
     }
     const projection = { limit: 10, sort: { createdAt: -1 } };
 
@@ -495,7 +495,7 @@ Boards.helpers({
       query.type = 'template-list';
       query.archived = false;
     } else {
-        query.type = {$nin: ['template-list']};
+      query.type = {$nin: ['template-list']};
     }
     const projection = { limit: 10, sort: { createdAt: -1 } };
 
@@ -522,7 +522,7 @@ Boards.helpers({
       query.type = 'template-card';
       query.archived = false;
     } else {
-        query.type = {$nin: ['template-card']};
+      query.type = {$nin: ['template-card']};
     }
     const projection = { limit: 10, sort: { createdAt: -1 } };
 
@@ -975,7 +975,7 @@ if (Meteor.isServer) {
    * @param {string} userId the ID of the user to retrieve the data
    * @return_type [{_id: string,
                     title: string}]
-   */
+                    */
   JsonRoutes.add('GET', '/api/users/:userId/boards', function (req, res) {
     try {
       Authentication.checkLoggedIn(req.userId);
@@ -1012,7 +1012,7 @@ if (Meteor.isServer) {
    *
    * @return_type [{_id: string,
                     title: string}]
-   */
+                    */
   JsonRoutes.add('GET', '/api/boards', function (req, res) {
     try {
       Authentication.checkUserId(req.userId);
@@ -1083,7 +1083,7 @@ if (Meteor.isServer) {
    *
    * @return_type {_id: string,
                    defaultSwimlaneId: string}
-   */
+                   */
   JsonRoutes.add('POST', '/api/boards', function (req, res) {
     try {
       Authentication.checkUserId(req.userId);

+ 19 - 19
models/cards.js

@@ -273,28 +273,28 @@ Cards.allow({
 
 Cards.helpers({
   copy() {
-      const oldId = this._id;
-      this._id = null;
-      const _id = Cards.insert(this);
+    const oldId = this._id;
+    this._id = null;
+    const _id = Cards.insert(this);
 
-      // copy checklists
-      Checklists.find({cardId: oldId}).forEach((ch) => {
-          ch.copy(_id);
-      });
+    // copy checklists
+    Checklists.find({cardId: oldId}).forEach((ch) => {
+      ch.copy(_id);
+    });
 
-      // copy subtasks
-      Cards.find({parentId: oldId}).forEach((subtask) => {
-        subtask.parentId = _id;
-        subtask._id = null;
-        Cards.insert(subtask);
-      });
+    // copy subtasks
+    Cards.find({parentId: oldId}).forEach((subtask) => {
+      subtask.parentId = _id;
+      subtask._id = null;
+      Cards.insert(subtask);
+    });
 
-      // copy card comments
-      CardComments.find({cardId: oldId}).forEach((cmt) => {
-          cmt.copy(_id);
-      });
+    // copy card comments
+    CardComments.find({cardId: oldId}).forEach((cmt) => {
+      cmt.copy(_id);
+    });
 
-      return _id;
+    return _id;
   },
 
   list() {
@@ -1259,7 +1259,7 @@ Cards.mutations({
 
 function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) {
   if ((_.contains(fieldNames, 'listId') && doc.listId !== oldListId) ||
-      (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){
+    (_.contains(fieldNames, 'swimlaneId') && doc.swimlaneId !== oldSwimlaneId)){
     Activities.insert({
       userId,
       oldListId,

+ 10 - 10
models/checklists.js

@@ -49,16 +49,16 @@ Checklists.attachSchema(new SimpleSchema({
 
 Checklists.helpers({
   copy(newCardId) {
-      const oldChecklistId = this._id;
-      this._id = null;
-      this.cardId = newCardId;
-      const newChecklistId = Checklists.insert(this);
-      ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => {
-        item._id = null;
-        item.checklistId = newChecklistId;
-        item.cardId = newCardId;
-        ChecklistItems.insert(item);
-      });
+    const oldChecklistId = this._id;
+    this._id = null;
+    this.cardId = newCardId;
+    const newChecklistId = Checklists.insert(this);
+    ChecklistItems.find({checklistId: oldChecklistId}).forEach((item) => {
+      item._id = null;
+      item.checklistId = newChecklistId;
+      item.cardId = newCardId;
+      ChecklistItems.insert(item);
+    });
   },
 
   itemCount() {

+ 25 - 25
models/lists.js

@@ -138,30 +138,30 @@ Lists.allow({
 
 Lists.helpers({
   copy() {
-      const oldId = this._id;
-      let _id = null;
-      existingListWithSameName = Lists.findOne({
-          boardId: this.boardId,
-          title: this.title,
-      });
-      if (existingListWithSameName) {
-          _id = existingListWithSameName._id;
-      } else {
-        this._id = null;
-        _id = Lists.insert(this);
-      }
+    const oldId = this._id;
+    let _id = null;
+    existingListWithSameName = Lists.findOne({
+      boardId: this.boardId,
+      title: this.title,
+    });
+    if (existingListWithSameName) {
+      _id = existingListWithSameName._id;
+    } else {
+      this._id = null;
+      _id = Lists.insert(this);
+    }
 
-      // Copy all cards in list
-      Cards.find({
-          listId: oldId,
-          archived: false,
-      }).forEach((card) => {
-          card.type = 'cardType-card';
-          card.listId = _id;
-          card.boardId = this.boardId;
-          card.swimlaneId = this.swimlaneId;
-          card.copy();
-      });
+    // Copy all cards in list
+    Cards.find({
+      listId: oldId,
+      archived: false,
+    }).forEach((card) => {
+      card.type = 'cardType-card';
+      card.listId = _id;
+      card.boardId = this.boardId;
+      card.swimlaneId = this.swimlaneId;
+      card.copy();
+    });
   },
 
   cards(swimlaneId) {
@@ -224,7 +224,7 @@ Lists.mutations({
   archive() {
     if (this.isTemplateList()) {
       this.cards().forEach((card) => {
-          return card.archive();
+        return card.archive();
       });
     }
     return { $set: { archived: true } };
@@ -233,7 +233,7 @@ Lists.mutations({
   restore() {
     if (this.isTemplateList()) {
       this.allCards().forEach((card) => {
-          return card.restore();
+        return card.restore();
       });
     }
     return { $set: { archived: false } };

+ 24 - 24
models/swimlanes.js

@@ -102,20 +102,20 @@ Swimlanes.allow({
 
 Swimlanes.helpers({
   copy() {
-      const oldId = this._id;
-      this._id = null;
-      const _id = Swimlanes.insert(this);
+    const oldId = this._id;
+    this._id = null;
+    const _id = Swimlanes.insert(this);
 
-      // Copy all lists in swimlane
-      Lists.find({
-          swimlaneId: oldId,
-          archived: false,
-      }).forEach((list) => {
-          list.type = 'list';
-          list.swimlaneId = _id;
-          list.boardId = this.boardId;
-          list.copy();
-      });
+    // Copy all lists in swimlane
+    Lists.find({
+      swimlaneId: oldId,
+      archived: false,
+    }).forEach((list) => {
+      list.type = 'list';
+      list.swimlaneId = _id;
+      list.boardId = this.boardId;
+      list.copy();
+    });
   },
 
   cards() {
@@ -127,8 +127,8 @@ Swimlanes.helpers({
 
   lists() {
     return Lists.find(Filter.mongoSelector({
-        swimlaneId: this._id,
-        archived: false,
+      swimlaneId: this._id,
+      archived: false,
     }), { sort: ['sort'] });
   },
 
@@ -155,22 +155,22 @@ Swimlanes.helpers({
   },
 
   isTemplateContainer() {
-      return this.type === 'template-container';
+    return this.type === 'template-container';
   },
 
   isListTemplatesSwimlane() {
-      const user = Users.findOne(Meteor.userId());
-      return user.profile.listTemplatesSwimlaneId === this._id;
+    const user = Users.findOne(Meteor.userId());
+    return user.profile.listTemplatesSwimlaneId === this._id;
   },
 
   isCardTemplatesSwimlane() {
-      const user = Users.findOne(Meteor.userId());
-      return user.profile.cardTemplatesSwimlaneId === this._id;
+    const user = Users.findOne(Meteor.userId());
+    return user.profile.cardTemplatesSwimlaneId === this._id;
   },
 
   isBoardTemplatesSwimlane() {
-      const user = Users.findOne(Meteor.userId());
-      return user.profile.boardTemplatesSwimlaneId === this._id;
+    const user = Users.findOne(Meteor.userId());
+    return user.profile.boardTemplatesSwimlaneId === this._id;
   },
 });
 
@@ -182,7 +182,7 @@ Swimlanes.mutations({
   archive() {
     if (this.isTemplateSwimlane()) {
       this.lists().forEach((list) => {
-          return list.archive();
+        return list.archive();
       });
     }
     return { $set: { archived: true } };
@@ -191,7 +191,7 @@ Swimlanes.mutations({
   restore() {
     if (this.isTemplateSwimlane()) {
       this.allLists().forEach((list) => {
-          return list.restore();
+        return list.restore();
       });
     }
     return { $set: { archived: false } };

+ 41 - 41
models/users.js

@@ -358,11 +358,11 @@ Users.helpers({
   },
 
   getTemplatesBoardId() {
-      return this.profile.templatesBoardId;
+    return this.profile.templatesBoardId;
   },
 
   getTemplatesBoardSlug() {
-      return Boards.findOne(this.profile.templatesBoardId).slug;
+    return Boards.findOne(this.profile.templatesBoardId).slug;
   },
 });
 
@@ -741,47 +741,47 @@ if (Meteor.isServer) {
         Boards.insert({
           title: TAPi18n.__('templates'),
           permission: 'private',
-          type: 'template-container'
+          type: 'template-container',
         }, fakeUser, (err, boardId) => {
 
-            // Insert the reference to our templates board
-            Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}});
-
-            // Insert the card templates swimlane
-            Swimlanes.insert({
-                title: TAPi18n.__('card-templates-swimlane'),
-                boardId,
-                sort: 1,
-                type: 'template-container',
-            }, fakeUser, (err, swimlaneId) => {
-
-                // Insert the reference to out card templates swimlane
-                Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}});
-            });
-
-            // Insert the list templates swimlane
-            Swimlanes.insert({
-                title: TAPi18n.__('list-templates-swimlane'),
-                boardId,
-                sort: 2,
-                type: 'template-container',
-            }, fakeUser, (err, swimlaneId) => {
-
-                // Insert the reference to out list templates swimlane
-                Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}});
-            });
-
-            // Insert the board templates swimlane
-            Swimlanes.insert({
-                title: TAPi18n.__('board-templates-swimlane'),
-                boardId,
-                sort: 3,
-                type: 'template-container',
-            }, fakeUser, (err, swimlaneId) => {
-
-                // Insert the reference to out board templates swimlane
-                Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}});
-            });
+          // Insert the reference to our templates board
+          Users.update(fakeUserId.get(), {$set: {'profile.templatesBoardId': boardId}});
+
+          // Insert the card templates swimlane
+          Swimlanes.insert({
+            title: TAPi18n.__('card-templates-swimlane'),
+            boardId,
+            sort: 1,
+            type: 'template-container',
+          }, fakeUser, (err, swimlaneId) => {
+
+            // Insert the reference to out card templates swimlane
+            Users.update(fakeUserId.get(), {$set: {'profile.cardTemplatesSwimlaneId': swimlaneId}});
+          });
+
+          // Insert the list templates swimlane
+          Swimlanes.insert({
+            title: TAPi18n.__('list-templates-swimlane'),
+            boardId,
+            sort: 2,
+            type: 'template-container',
+          }, fakeUser, (err, swimlaneId) => {
+
+            // Insert the reference to out list templates swimlane
+            Users.update(fakeUserId.get(), {$set: {'profile.listTemplatesSwimlaneId': swimlaneId}});
+          });
+
+          // Insert the board templates swimlane
+          Swimlanes.insert({
+            title: TAPi18n.__('board-templates-swimlane'),
+            boardId,
+            sort: 3,
+            type: 'template-container',
+          }, fakeUser, (err, swimlaneId) => {
+
+            // Insert the reference to out board templates swimlane
+            Users.update(fakeUserId.get(), {$set: {'profile.boardTemplatesSwimlaneId': swimlaneId}});
+          });
         });
       });
     });