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

Chore: Apply eslint rules

This commit is contained in:
Laurent Cozic
2019-09-19 22:51:18 +01:00
parent ab29d7e872
commit e648392330
185 changed files with 1196 additions and 1196 deletions

View File

@ -53,7 +53,7 @@ function shimInit() {
buffer = nativeImage.toJPEG(90);
}
if (!buffer) throw new Error('Cannot resize image because mime type "' + mime + '" is not supported: ' + targetPath);
if (!buffer) throw new Error(`Cannot resize image because mime type "${mime}" is not supported: ${targetPath}`);
await shim.fsDriver().writeFile(targetPath, buffer, 'buffer');
} else {
@ -68,7 +68,7 @@ function shimInit() {
// For Electron
const nativeImage = require('electron').nativeImage;
let image = nativeImage.createFromPath(filePath);
if (image.isEmpty()) throw new Error('Image is invalid or does not exist: ' + filePath);
if (image.isEmpty()) throw new Error(`Image is invalid or does not exist: ${filePath}`);
const size = image.getSize();
@ -167,7 +167,7 @@ function shimInit() {
}
const itDoes = await shim.fsDriver().waitTillExists(targetPath);
if (!itDoes) throw new Error('Resource file was not created: ' + targetPath);
if (!itDoes) throw new Error(`Resource file was not created: ${targetPath}`);
const fileStat = await shim.fsDriver().stat(targetPath);
resource.size = fileStat.size;
@ -197,7 +197,7 @@ function shimInit() {
newBody.push(Resource.markdownTag(resource));
} else {
let filename = escapeLinkText(basename(filePath)); // to get same filename as standard drag and drop
let fileURL = '[' + filename + '](' + toFileProtocolPath(filePath) + ')';
let fileURL = `[${filename}](${toFileProtocolPath(filePath)})`;
newBody.push(fileURL);
}
@ -246,7 +246,7 @@ function shimInit() {
shim.fetch = async function(url, options = null) {
const validatedUrl = urlValidator.isUri(url);
if (!validatedUrl) throw new Error('Not a valid URL: ' + url);
if (!validatedUrl) throw new Error(`Not a valid URL: ${url}`);
return shim.fetchWithRetry(() => {
return nodeFetch(url, options);
@ -274,7 +274,7 @@ function shimInit() {
return response.statusMessage;
},
json: () => {
return { message: response.statusCode + ': ' + response.statusMessage };
return { message: `${response.statusCode}: ${response.statusMessage}` };
},
status: response.statusCode,
headers: response.headers,
@ -286,7 +286,7 @@ function shimInit() {
host: url.hostname,
port: url.port,
method: method,
path: url.pathname + (url.query ? '?' + url.query : ''),
path: url.pathname + (url.query ? `?${url.query}` : ''),
headers: headers,
};