1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

First pass at linting lib dir

This commit is contained in:
Laurent Cozic
2019-07-29 15:43:53 +02:00
parent 64b7bc3d62
commit 86dc72b204
170 changed files with 4140 additions and 3119 deletions

View File

@ -6,7 +6,7 @@ const { basicDelta } = require('lib/file-api');
// both clients will not know about each others updates during the next sync. They will simply both sync their note and whoever
// comes last will overwrite (on the remote storage) the note of the other client. Both client will then have a different note at
// that point and that will only be resolved if one of them changes the note and sync (if they don't change it, it will never get resolved).
//
//
// This is compound with the fact that we can't have a reliable delta API on the file system so we need to check all the timestamps
// every time and rely on this exclusively to know about changes.
//
@ -15,7 +15,6 @@ const { basicDelta } = require('lib/file-api');
// will have been modified at the same exact second at some point. If not, it's another bug that needs to be investigated.
class FileApiDriverLocal {
fsErrorToJsError_(error, path = null) {
let msg = error.toString();
if (path !== null) msg += '. Path: ' + path;
@ -66,7 +65,7 @@ class FileApiDriverLocal {
}
async delta(path, options) {
const getStatFn = async (path) => {
const getStatFn = async path => {
const stats = await this.fsDriver().readDirStats(path);
return this.metadataFromStats_(stats);
};
@ -74,7 +73,7 @@ class FileApiDriverLocal {
try {
const output = await basicDelta(path, getStatFn, options);
return output;
} catch(error) {
} catch (error) {
throw this.fsErrorToJsError_(error, path);
}
}
@ -89,7 +88,7 @@ class FileApiDriverLocal {
hasMore: false,
context: null,
};
} catch(error) {
} catch (error) {
throw this.fsErrorToJsError_(error, path);
}
}
@ -128,7 +127,7 @@ class FileApiDriverLocal {
// resolve();
// return;
// }
// fs.mkdirp(path, (error) => {
// if (error) {
// reject(this.fsErrorToJsError_(error));
@ -148,7 +147,7 @@ class FileApiDriverLocal {
await this.fsDriver().copy(options.path, path);
return;
}
await this.fsDriver().writeFile(path, content, 'utf8');
} catch (error) {
throw this.fsErrorToJsError_(error, path);
@ -200,7 +199,7 @@ class FileApiDriverLocal {
}
// let lastError = null;
// for (let i = 0; i < 5; i++) {
// try {
// let output = await fs.move(oldPath, newPath, { overwrite: true });
@ -228,7 +227,6 @@ class FileApiDriverLocal {
await this.fsDriver().remove(baseDir);
await this.fsDriver().mkdir(baseDir);
}
}
module.exports = { FileApiDriverLocal };
module.exports = { FileApiDriverLocal };