Add some ESLint rules and fix some related issues

This commit is contained in:
Maxime Quandalle 2015-10-14 23:50:12 +02:00
parent 43de3b8a01
commit 944a1065d3
5 changed files with 46 additions and 42 deletions

View file

@ -1,7 +1,7 @@
Meteor.methods({
importTrelloCard(trelloCard, listId, sortIndex) {
// 1. check parameters are ok from a syntax point of view
DateString = Match.Where(function (dateAsString) {
const DateString = Match.Where(function (dateAsString) {
check(dateAsString, String);
return moment(dateAsString, moment.ISO_8601).isValid();
});
@ -25,9 +25,6 @@ Meteor.methods({
check(listId, String);
check(sortIndex, Number);
} catch(e) {
if(Meteor.isServer) {
console.log(e);
}
throw new Meteor.Error('error-json-schema');
}
@ -59,7 +56,9 @@ Meteor.methods({
};
// 4. find actual creation date
const creationAction = trelloCard.actions.find((action) => {return action.type === 'createCard';});
const creationAction = trelloCard.actions.find((action) => {
return action.type === 'createCard';
});
if(creationAction) {
cardToCreate.createdAt = creationAction.date;
}
@ -92,7 +91,7 @@ Meteor.methods({
Activities.direct.insert({
activityType: 'importCard',
boardId: cardToCreate.boardId,
cardId: cardId,
cardId,
createdAt: dateOfImport,
listId: cardToCreate.listId,
source: {
@ -109,7 +108,7 @@ Meteor.methods({
if(currentAction.type === 'commentCard') {
const commentToCreate = {
boardId: list.boardId,
cardId: cardId,
cardId,
createdAt: currentAction.date,
text: currentAction.data.text,
// XXX use the original comment user instead
@ -120,7 +119,7 @@ Meteor.methods({
activityType: 'addComment',
boardId: commentToCreate.boardId,
cardId: commentToCreate.cardId,
commentId: commentId,
commentId,
createdAt: commentToCreate.createdAt,
userId: commentToCreate.userId,
});