summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-10-14 23:50:12 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-10-14 23:50:12 +0200
commit944a1065d372095e8a0898a4162ca6bb562bab69 (patch)
treef179e744acc7adfe7d2354ce0127daadb6e4104f
parent43de3b8a01b001ec665294fa8bd75f5d01df7df0 (diff)
downloadwekan-944a1065d372095e8a0898a4162ca6bb562bab69.tar.gz
wekan-944a1065d372095e8a0898a4162ca6bb562bab69.tar.bz2
wekan-944a1065d372095e8a0898a4162ca6bb562bab69.zip
Add some ESLint rules and fix some related issues
-rw-r--r--.eslintrc58
-rw-r--r--.travis.yml1
-rw-r--r--client/components/lists/listHeader.js6
-rw-r--r--client/lib/accessibility.js8
-rw-r--r--models/import.js15
5 files changed, 46 insertions, 42 deletions
diff --git a/.eslintrc b/.eslintrc
index 2187cf75..081b2a56 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -2,41 +2,46 @@ ecmaFeatures:
experimentalObjectRestSpread: true
rules:
- accessor-pairs: [2]
- consistent-return: [2]
+ accessor-pairs: 2
+ comma-dangle: [2, 'always-multiline']
+ consistent-return: 2
+ dot-notation: 2
+ eqeqeq: 2
indent: [2, 2]
- semi: [2, always]
- comma-dangle: [2, always-multiline]
+ no-cond-assign: 2
+ no-constant-condition: 2
+ no-eval: 2
no-inner-declarations: [0]
- dot-notation: [2]
- eqeqeq: [2]
- no-eval: [2]
- radix: [2]
+ no-unneeded-ternary: 2
+ radix: 2
+ semi: [2, always]
# Stylistic Issues
- camelcase: [2]
- comma-spacing: [2]
- comma-style: [2]
- new-parens: [2]
- no-lonely-if: [2]
- no-multiple-empty-lines: [2]
- no-nested-ternary: [2]
+ camelcase: 2
+ comma-spacing: 2
+ comma-style: 2
linebreak-style: [2, unix]
+ new-parens: 2
+ no-lonely-if: 2
+ no-multiple-empty-lines: 2
+ no-nested-ternary: 2
+ no-spaced-func: 2
+ operator-linebreak: 2
quotes: [2, single]
- semi-spacing: [2]
+ semi-spacing: 2
+ space-unary-ops: 2
spaced-comment: [2, always, markers: ['/']]
- space-unary-ops: [2]
# ECMAScript 6
- arrow-parens: [2]
- arrow-spacing: [2]
- no-class-assign: [2]
- no-dupe-class-members: [2]
- no-var: [2]
- object-shorthand: [2]
- prefer-const: [2]
- prefer-template: [2]
- prefer-spread: [2]
+ arrow-parens: 2
+ arrow-spacing: 2
+ no-class-assign: 2
+ no-dupe-class-members: 2
+ no-var: 2
+ object-shorthand: 2
+ prefer-const: 2
+ prefer-spread: 2
+ prefer-template: 2
globals:
# Meteor globals
@@ -78,6 +83,7 @@ globals:
FS: false
getSlug: false
Migrations: false
+ moment: false
Mousetrap: false
Picker: false
Presence: true
diff --git a/.travis.yml b/.travis.yml
index 2499948a..55f8ed48 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,5 +4,6 @@ node_js:
- "0.10.40"
install:
- "npm install -g eslint"
+ - "npm install -g eslint-plugin-meteor"
script:
- "eslint ./"
diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js
index 7db93618..e34d23fd 100644
--- a/client/components/lists/listHeader.js
+++ b/client/components/lists/listHeader.js
@@ -62,14 +62,12 @@ BlazeComponent.extendComponent({
try {
trelloCard = JSON.parse(jsonData);
} catch (e) {
- console.log(e);
this.setError('error-json-malformed');
return;
}
Meteor.call('importTrelloCard', trelloCard, this.currentData()._id, sortIndex,
(error, response) => {
if (error) {
- console.log(error);
this.setError(error.error);
} else {
Filter.addException(response);
@@ -77,8 +75,8 @@ BlazeComponent.extendComponent({
}
}
);
- }
- },];
+ },
+ }];
},
onCreated() {
diff --git a/client/lib/accessibility.js b/client/lib/accessibility.js
index 64195b81..52b771d4 100644
--- a/client/lib/accessibility.js
+++ b/client/lib/accessibility.js
@@ -7,7 +7,7 @@
// Without an href, links are non-keyboard-focusable and are not presented on
// blind screen readers. We default to the empty anchor `#` href.
function enforceHref(attributes) {
- if (! _.has(attributes, 'href')) {
+ if (!_.has(attributes, 'href')) {
attributes.href = '#';
}
return attributes;
@@ -17,7 +17,7 @@ function enforceHref(attributes) {
// presented by screen readers. `aria-label`, on the other hand, is specific to
// accessibility and is presented in ways that title shouldn't be.
function copyTitleInAriaLabel(attributes) {
- if (! _.has(attributes, 'aria-label') && _.has(attributes, 'title')) {
+ if (!_.has(attributes, 'aria-label') && _.has(attributes, 'title')) {
attributes['aria-label'] = attributes.title;
}
return attributes;
@@ -34,8 +34,8 @@ const {
HTML.A = (attributes, ...others) => {
return superA(copyTitleInAriaLabel(enforceHref(attributes)), ...others);
-}
+};
HTML.I = (attributes, ...others) => {
return superI(copyTitleInAriaLabel(attributes), ...others);
-}
+};
diff --git a/models/import.js b/models/import.js
index 51206ea3..4fe4b478 100644
--- a/models/import.js
+++ b/models/import.js
@@ -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,
});