1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Tools: Added eslint rule arrow-parens

This commit is contained in:
Laurent Cozic
2020-05-20 17:16:43 +01:00
parent c34f762507
commit 0b6f5581f0
166 changed files with 446 additions and 445 deletions

View File

@@ -21,7 +21,7 @@ class Alarm extends BaseModel {
static async alarmIdsWithoutNotes() {
// https://stackoverflow.com/a/4967229/561309
const alarms = await this.db().selectAll('SELECT alarms.id FROM alarms LEFT JOIN notes ON alarms.note_id = notes.id WHERE notes.id IS NULL');
return alarms.map(a => {
return alarms.map((a) => {
return a.id;
});
}

View File

@@ -186,7 +186,7 @@ class BaseItem extends BaseModel {
let conflictNoteIds = [];
if (this.modelType() == BaseModel.TYPE_NOTE) {
const conflictNotes = await this.db().selectAll(`SELECT id FROM notes WHERE id IN ("${ids.join('","')}") AND is_conflict = 1`);
conflictNoteIds = conflictNotes.map(n => {
conflictNoteIds = conflictNotes.map((n) => {
return n.id;
});
}
@@ -609,7 +609,7 @@ class BaseItem extends BaseModel {
}
static syncItemClassNames() {
return BaseItem.syncItemDefinitions_.map(def => {
return BaseItem.syncItemDefinitions_.map((def) => {
return def.className;
});
}
@@ -625,7 +625,7 @@ class BaseItem extends BaseModel {
}
static syncItemTypes() {
return BaseItem.syncItemDefinitions_.map(def => {
return BaseItem.syncItemDefinitions_.map((def) => {
return def.type;
});
}
@@ -726,7 +726,7 @@ class BaseItem extends BaseModel {
);
const items = await ItemClass.modelSelectAll(sql);
const ids = items.map(item => {
const ids = items.map((item) => {
return item.id;
});
if (!ids.length) continue;

View File

@@ -34,7 +34,7 @@ class Folder extends BaseItem {
static noteIds(parentId) {
return this.db()
.selectAll('SELECT id FROM notes WHERE is_conflict = 0 AND parent_id = ?', [parentId])
.then(rows => {
.then((rows) => {
const output = [];
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
@@ -46,7 +46,7 @@ class Folder extends BaseItem {
static async subFolderIds(parentId) {
const rows = await this.db().selectAll('SELECT id FROM folders WHERE parent_id = ?', [parentId]);
return rows.map(r => r.id);
return rows.map((r) => r.id);
}
static async noteCount(parentId) {
@@ -143,7 +143,7 @@ class Folder extends BaseItem {
folderIdToTime[row.parent_id] = row.content_updated_time;
}
const findFolderParent = folderId => {
const findFolderParent = (folderId) => {
const folder = BaseModel.byId(folders, folderId);
if (!folder) return null; // For the rare case of notes that are associated with a no longer existing folder
if (!folder.parent_id) return null;
@@ -157,7 +157,7 @@ class Folder extends BaseItem {
return null;
};
const applyChildTimeToParent = folderId => {
const applyChildTimeToParent = (folderId) => {
const parent = findFolderParent(folderId);
if (!parent) return;
@@ -429,7 +429,7 @@ class Folder extends BaseItem {
if (o.title == Folder.conflictFolderTitle()) throw new Error(_('Notebooks cannot be named "%s", which is a reserved title.', o.title));
}
return super.save(o, options).then(folder => {
return super.save(o, options).then((folder) => {
this.dispatch({
type: 'FOLDER_UPDATE_ONE',
item: folder,

View File

@@ -19,11 +19,11 @@ class MasterKey extends BaseItem {
}
static allWithoutEncryptionMethod(masterKeys, method) {
return masterKeys.filter(m => m.encryption_method !== method);
return masterKeys.filter((m) => m.encryption_method !== method);
}
static async save(o, options = null) {
return super.save(o, options).then(item => {
return super.save(o, options).then((item) => {
this.dispatch({
type: 'MASTERKEY_UPDATE_ONE',
item: item,

View File

@@ -104,7 +104,7 @@ class Note extends BaseItem {
if (!body || body.length <= 32) return [];
const links = urlUtils.extractResourceUrls(body);
const itemIds = links.map(l => l.itemId);
const itemIds = links.map((l) => l.itemId);
return ArrayUtils.unique(itemIds);
}
@@ -175,7 +175,7 @@ class Note extends BaseItem {
for (const basePath of pathsToTry) {
const reString = `${pregQuote(`${basePath}/`)}[a-zA-Z0-9.]+`;
const re = new RegExp(reString, 'gi');
body = body.replace(re, match => {
body = body.replace(re, (match) => {
const id = Resource.pathToId(match);
return `:/${id}`;
});
@@ -200,7 +200,7 @@ class Note extends BaseItem {
// Note: sort logic must be duplicated in previews();
static sortNotes(notes, orders, uncompletedTodosOnTop) {
const noteOnTop = note => {
const noteOnTop = (note) => {
return uncompletedTodosOnTop && note.is_todo && !note.todo_completed;
};

View File

@@ -66,7 +66,7 @@ class NoteResource extends BaseModel {
`,
[cutOffTime]
);
return output.map(r => r.resource_id);
return output.map((r) => r.resource_id);
}
static async deleteByResource(resourceId) {

View File

@@ -67,7 +67,7 @@ class Revision extends BaseItem {
static patchStats(patch) {
if (typeof patch === 'object') throw new Error('Not implemented');
const countChars = diffLine => {
const countChars = (diffLine) => {
return unescape(diffLine).length - 1;
};
@@ -125,7 +125,7 @@ class Revision extends BaseItem {
if (!itemIds.length) return [];
const rows = await this.db().selectAll(`SELECT distinct item_id FROM revisions WHERE item_type = ? AND item_id IN ("${itemIds.join('","')}")`, [itemType]);
return rows.map(r => r.item_id);
return rows.map((r) => r.item_id);
}
static async itemsWithNoRevisions(itemType, itemIds) {

View File

@@ -12,7 +12,7 @@ class Search extends BaseModel {
static keywords(query) {
let output = query.trim();
output = output.split(/[\s\t\n]+/);
output = output.filter(o => !!o);
output = output.filter((o) => !!o);
return output;
}
}

View File

@@ -56,7 +56,7 @@ class Setting extends BaseModel {
public: true,
section: 'sync',
label: () => _('Synchronisation target'),
description: appType => {
description: (appType) => {
return appType !== 'cli' ? null : _('The target to synchonise to. Each sync target may have additional parameters which are named as `sync.NUM.NAME` (all documented below).');
},
options: () => {
@@ -68,14 +68,14 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
try {
return settings['sync.target'] == SyncTargetRegistry.nameToId('filesystem');
} catch (error) {
return false;
}
},
filter: value => {
filter: (value) => {
return value ? rtrimSlashes(value) : '';
},
public: true,
@@ -87,7 +87,7 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
return settings['sync.target'] == SyncTargetRegistry.nameToId('nextcloud');
},
public: true,
@@ -98,7 +98,7 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
return settings['sync.target'] == SyncTargetRegistry.nameToId('nextcloud');
},
public: true,
@@ -108,7 +108,7 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
return settings['sync.target'] == SyncTargetRegistry.nameToId('nextcloud');
},
public: true,
@@ -120,7 +120,7 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
return settings['sync.target'] == SyncTargetRegistry.nameToId('webdav');
},
public: true,
@@ -131,7 +131,7 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
return settings['sync.target'] == SyncTargetRegistry.nameToId('webdav');
},
public: true,
@@ -141,7 +141,7 @@ class Setting extends BaseModel {
value: '',
type: Setting.TYPE_STRING,
section: 'sync',
show: settings => {
show: (settings) => {
return settings['sync.target'] == SyncTargetRegistry.nameToId('webdav');
},
public: true,
@@ -557,7 +557,7 @@ class Setting extends BaseModel {
type: Setting.TYPE_STRING,
section: 'sync',
advanced: true,
show: settings => {
show: (settings) => {
return [SyncTargetRegistry.nameToId('nextcloud'), SyncTargetRegistry.nameToId('webdav')].indexOf(settings['sync.target']) >= 0;
},
public: true,
@@ -570,7 +570,7 @@ class Setting extends BaseModel {
type: Setting.TYPE_BOOL,
advanced: true,
section: 'sync',
show: settings => {
show: (settings) => {
return [SyncTargetRegistry.nameToId('nextcloud'), SyncTargetRegistry.nameToId('webdav')].indexOf(settings['sync.target']) >= 0;
},
public: true,
@@ -723,7 +723,7 @@ class Setting extends BaseModel {
static load() {
this.cancelScheduleSave();
this.cache_ = [];
return this.modelSelectAll('SELECT * FROM settings').then(rows => {
return this.modelSelectAll('SELECT * FROM settings').then((rows) => {
this.cache_ = [];
for (let i = 0; i < rows.length; i++) {

View File

@@ -119,7 +119,7 @@ class Tag extends BaseItem {
let commonTagIds = await NoteTag.tagIdsByNoteId(noteIds[0]);
for (let i = 1; i < noteIds.length; i++) {
const tagIds = await NoteTag.tagIdsByNoteId(noteIds[i]);
commonTagIds = commonTagIds.filter(value => tagIds.includes(value));
commonTagIds = commonTagIds.filter((value) => tagIds.includes(value));
if (commonTagIds.length === 0) {
break;
}
@@ -184,7 +184,7 @@ class Tag extends BaseItem {
}
}
return super.save(o, options).then(tag => {
return super.save(o, options).then((tag) => {
this.dispatch({
type: 'TAG_UPDATE_ONE',
item: tag,