1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Revert "Tools: Added eslint rule arrow-parens"

This reverts commit 0b6f5581f0.

It causes too many conflicts with pull requests.
This commit is contained in:
Laurent Cozic
2020-05-21 09:14:33 +01:00
parent b83eee751f
commit a96734f5be
166 changed files with 444 additions and 445 deletions

View File

@@ -5,7 +5,7 @@ class AlarmServiceDriver {
this.hasPermission_ = null;
this.inAppNotificationHandler_ = null;
PushNotificationIOS.addEventListener('localNotification', (instance) => {
PushNotificationIOS.addEventListener('localNotification', instance => {
if (!this.inAppNotificationHandler_) return;
if (!instance || !instance._data || !instance._data.id) {
@@ -36,7 +36,7 @@ class AlarmServiceDriver {
if (this.hasPermission_ !== null) return this.hasPermission_;
return new Promise((resolve) => {
PushNotificationIOS.checkPermissions(async (perm) => {
PushNotificationIOS.checkPermissions(async perm => {
const ok = await this.hasPermissions(perm);
this.hasPermission_ = ok;
resolve(ok);

View File

@@ -74,8 +74,8 @@ class DecryptionWorker {
async decryptionDisabledItems() {
let items = await this.kvStore().searchByPrefix('decrypt:');
items = items.filter((item) => item.value > this.maxDecryptionAttempts_);
items = items.map((item) => {
items = items.filter(item => item.value > this.maxDecryptionAttempts_);
items = items.map(item => {
const s = item.key.split(':');
return {
type_: Number(s[1]),

View File

@@ -216,7 +216,7 @@ class EncryptionService {
async randomHexString(byteCount) {
const bytes = await shim.randomBytes(byteCount);
return bytes
.map((a) => {
.map(a => {
return hexPad(a.toString(16), 2);
})
.join('');
@@ -251,7 +251,7 @@ class EncryptionService {
}, options);
const bytes = await shim.randomBytes(256);
const hexaBytes = bytes.map((a) => hexPad(a.toString(16), 2)).join('');
const hexaBytes = bytes.map(a => hexPad(a.toString(16), 2)).join('');
return this.encryptMasterKeyContent_(options.encryptionMethod, hexaBytes, password);
}
@@ -505,7 +505,7 @@ class EncryptionService {
const handle = await this.fsDriver().open(path, 'r');
const reader = {
handle: handle,
read: async (size) => {
read: async size => {
return this.fsDriver().readFileChunk(reader.handle, size, encoding);
},
close: async () => {
@@ -517,7 +517,7 @@ class EncryptionService {
async fileWriter_(path, encoding) {
return {
append: async (data) => {
append: async data => {
return this.fsDriver().appendFile(path, data, encoding);
},
close: function() {},

View File

@@ -214,7 +214,7 @@ class ExternalEditWatcher {
path = 'open';
}
const wrapError = (error) => {
const wrapError = error => {
if (!error) return error;
const msg = error.message ? [error.message] : [];
msg.push(`Command was: "${path}" ${args.join(' ')}`);
@@ -233,7 +233,7 @@ class ExternalEditWatcher {
}
}, 100);
subProcess.on('error', (error) => {
subProcess.on('error', error => {
clearInterval(iid);
reject(wrapError(error));
});

View File

@@ -95,7 +95,7 @@ class InteropService {
},
];
importModules = importModules.map((a) => {
importModules = importModules.map(a => {
const className = a.importerClass || `InteropService_Importer_${toTitleCase(a.format)}`;
const output = Object.assign(
{},
@@ -109,7 +109,7 @@ class InteropService {
return output;
});
exportModules = exportModules.map((a) => {
exportModules = exportModules.map(a => {
const className = `InteropService_Exporter_${toTitleCase(a.format)}`;
return Object.assign(
{},
@@ -123,7 +123,7 @@ class InteropService {
this.modules_ = importModules.concat(exportModules);
this.modules_ = this.modules_.map((a) => {
this.modules_ = this.modules_.map(a => {
a.fullLabel = function(moduleSource = null) {
const label = [`${this.format.toUpperCase()} - ${this.description}`];
if (moduleSource && this.sources.length > 1) {
@@ -156,7 +156,7 @@ class InteropService {
}
}
const output = matches.find((m) => !!m.isDefault);
const output = matches.find(m => !!m.isDefault);
if (output) return output;
return matches.length ? matches[0] : null;

View File

@@ -24,7 +24,7 @@ class InteropService_Exporter_Jex extends InteropService_Exporter_Base {
async close() {
const stats = await shim.fsDriver().readDirStats(this.tempDir_, { recursive: true });
const filePaths = stats.filter((a) => !a.isDirectory()).map((a) => a.path);
const filePaths = stats.filter(a => !a.isDirectory()).map(a => a.path);
if (!filePaths.length) throw new Error(_('There is no data to export.'));

View File

@@ -18,7 +18,7 @@ class InteropService_Importer_Raw extends InteropService_Importer_Base {
const noteTagsToCreate = [];
const destinationFolderId = this.options_.destinationFolderId;
const replaceLinkedItemIds = async (noteBody) => {
const replaceLinkedItemIds = async noteBody => {
let output = noteBody;
const itemIds = Note.linkedItemIds(noteBody);
@@ -52,7 +52,7 @@ class InteropService_Importer_Raw extends InteropService_Importer_Base {
return defaultFolder_;
};
const setFolderToImportTo = async (itemParentId) => {
const setFolderToImportTo = async itemParentId => {
// Logic is a bit complex here:
// - If a destination folder was specified, move the note to it.
// - Otherwise, if the associated folder exists, use this.

View File

@@ -39,7 +39,7 @@ class PluginManager {
const p = this.plugins_[name];
if (p.instance) return p.instance;
p.instance = new p.Class();
p.instance.dispatch = (action) => this.dispatch_(action);
p.instance.dispatch = action => this.dispatch_(action);
return p.instance;
}
@@ -73,7 +73,7 @@ class PluginManager {
dialogProps_(name) {
return {
dispatch: (action) => this.dispatch_(action),
dispatch: action => this.dispatch_(action),
plugin: this.pluginInstance_(name),
};
}

View File

@@ -176,7 +176,7 @@ class ResourceFetcher extends BaseService {
this.logger().debug(`ResourceFetcher: Resource downloaded: ${resource.id}`);
await completeDownload(true, localResourceContentPath);
})
.catch(async (error) => {
.catch(async error => {
this.logger().error(`ResourceFetcher: Could not download resource: ${resource.id}`, error);
await Resource.setLocalState(resource, { fetch_status: Resource.FETCH_STATUS_ERROR, fetch_error: error.message });
await completeDownload();

View File

@@ -46,10 +46,10 @@ class ResourceService extends BaseService {
if (!changes.length) break;
const noteIds = changes.map((a) => a.item_id);
const noteIds = changes.map(a => a.item_id);
const notes = await Note.modelSelectAll(`SELECT id, title, body, encryption_applied FROM notes WHERE id IN ("${noteIds.join('","')}")`);
const noteById = (noteId) => {
const noteById = noteId => {
for (let i = 0; i < notes.length; i++) {
if (notes[i].id === noteId) return notes[i];
}

View File

@@ -130,7 +130,7 @@ class RevisionService extends BaseService {
if (!changes.length) break;
const noteIds = changes.map((a) => a.item_id);
const noteIds = changes.map(a => a.item_id);
const notes = await Note.modelSelectAll(`SELECT * FROM notes WHERE is_conflict = 0 AND encryption_applied = 0 AND id IN ("${noteIds.join('","')}")`);
for (let i = 0; i < changes.length; i++) {

View File

@@ -53,7 +53,7 @@ class SearchEngine {
async rebuildIndex_() {
let noteIds = await this.db().selectAll('SELECT id FROM notes WHERE is_conflict = 0 AND encryption_applied = 0');
noteIds = noteIds.map((n) => n.id);
noteIds = noteIds.map(n => n.id);
const lastChangeId = await ItemChange.lastChangeId();
@@ -137,7 +137,7 @@ class SearchEngine {
if (!changes.length) break;
const noteIds = changes.map((a) => a.item_id);
const noteIds = changes.map(a => a.item_id);
const notes = await Note.modelSelectAll(`SELECT id, title, body FROM notes WHERE id IN ("${noteIds.join('","')}") AND is_conflict = 0 AND encryption_applied = 0`);
const queries = [];
@@ -238,7 +238,7 @@ class SearchEngine {
processResults_(rows, parsedQuery) {
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
const offsets = row.offsets.split(' ').map((o) => Number(o));
const offsets = row.offsets.split(' ').map(o => Number(o));
row.weight = this.calculateWeight_(offsets, parsedQuery.termCount);
row.fields = this.fieldNamesFromOffsets_(offsets);
}

View File

@@ -12,7 +12,7 @@ class SearchEngineUtils {
}
const results = await SearchEngine.instance().search(query, { searchType });
const noteIds = results.map((n) => n.id);
const noteIds = results.map(n => n.id);
// We need at least the note ID to be able to sort them below so if not
// present in field list, add it.L Also remember it was auto-added so that

View File

@@ -163,8 +163,8 @@ class Api {
if (!query || !query.fields) return defaultFields;
const fields = query.fields
.split(',')
.map((f) => f.trim())
.filter((f) => !!f);
.map(f => f.trim())
.filter(f => !!f);
return fields.length ? fields : defaultFields;
}
@@ -649,7 +649,7 @@ class Api {
const output = {};
const downloadOne = async (url) => {
const downloadOne = async url => {
const imagePath = await this.downloadImage_(url, allowFileProtocolImages);
if (imagePath) output[url] = { path: imagePath, originalUrl: url };
};
@@ -699,7 +699,7 @@ class Api {
const imageSizesIndexes = {};
if (markupLanguage === MarkupToHtml.MARKUP_LANGUAGE_HTML) {
return htmlUtils.replaceImageUrls(md, (imageUrl) => {
return htmlUtils.replaceImageUrls(md, imageUrl => {
const urlInfo = urls[imageUrl];
if (!urlInfo || !urlInfo.resource) return imageUrl;
return Resource.internalUrl(urlInfo.resource);