mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Enforce a consistent ES6 coding style
Replace the old (and broken) jshint + jscsrc by eslint and configure it to support some of the ES6 features. The command `eslint` currently has one error which is a bug that was discovered by its static analysis and should be fixed (usage of a dead object).
This commit is contained in:
parent
039cfe7edf
commit
b3851817ec
60 changed files with 1604 additions and 1692 deletions
|
|
@ -27,9 +27,9 @@ UnsavedEdits = {
|
|||
// _collection: UnsavedEditCollection,
|
||||
|
||||
get({ fieldName, docId }, defaultTo = '') {
|
||||
let unsavedValue = this._getCollectionDocument(fieldName, docId);
|
||||
const unsavedValue = this._getCollectionDocument(fieldName, docId);
|
||||
if (unsavedValue) {
|
||||
return unsavedValue.value
|
||||
return unsavedValue.value;
|
||||
} else {
|
||||
return defaultTo;
|
||||
}
|
||||
|
|
@ -40,13 +40,9 @@ UnsavedEdits = {
|
|||
},
|
||||
|
||||
set({ fieldName, docId }, value) {
|
||||
let currentDoc = this._getCollectionDocument(fieldName, docId);
|
||||
const currentDoc = this._getCollectionDocument(fieldName, docId);
|
||||
if (currentDoc) {
|
||||
UnsavedEditCollection.update(currentDoc._id, {
|
||||
$set: {
|
||||
value: value
|
||||
}
|
||||
});
|
||||
UnsavedEditCollection.update(currentDoc._id, { $set: { value }});
|
||||
} else {
|
||||
UnsavedEditCollection.insert({
|
||||
fieldName,
|
||||
|
|
@ -57,7 +53,7 @@ UnsavedEdits = {
|
|||
},
|
||||
|
||||
reset({ fieldName, docId }) {
|
||||
let currentDoc = this._getCollectionDocument(fieldName, docId);
|
||||
const currentDoc = this._getCollectionDocument(fieldName, docId);
|
||||
if (currentDoc) {
|
||||
UnsavedEditCollection.remove(currentDoc._id);
|
||||
}
|
||||
|
|
@ -65,13 +61,13 @@ UnsavedEdits = {
|
|||
|
||||
_getCollectionDocument(fieldName, docId) {
|
||||
return UnsavedEditCollection.findOne({fieldName, docId});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Blaze.registerHelper('getUnsavedValue', (fieldName, docId, defaultTo) => {
|
||||
// Workaround some blaze feature that ass a list of keywords arguments as the
|
||||
// last parameter (even if the caller didn't specify any).
|
||||
if (! _.isString(defaultTo)) {
|
||||
if (!_.isString(defaultTo)) {
|
||||
defaultTo = '';
|
||||
}
|
||||
return UnsavedEdits.get({ fieldName, docId }, defaultTo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue