mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04:00
Add some ESLint rules and fix some related issues
This commit is contained in:
parent
43de3b8a01
commit
944a1065d3
5 changed files with 46 additions and 42 deletions
58
.eslintrc
58
.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
|
||||
|
|
|
@ -4,5 +4,6 @@ node_js:
|
|||
- "0.10.40"
|
||||
install:
|
||||
- "npm install -g eslint"
|
||||
- "npm install -g eslint-plugin-meteor"
|
||||
script:
|
||||
- "eslint ./"
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue