1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-03 23:50:33 +02:00

Tools: Add prefer-arrow-callbacks to ESlint rules (#7810)

This commit is contained in:
pedr
2023-02-20 12:02:29 -03:00
committed by GitHub
parent ca575162f7
commit f2995dd196
206 changed files with 511 additions and 510 deletions

View File

@ -252,10 +252,10 @@ export async function downloadFile(url: string, targetPath: string) {
return new Promise((resolve, reject) => {
const file = fs.createWriteStream(targetPath);
https.get(url, function(response: any) {
https.get(url, (response: any) => {
if (response.statusCode !== 200) reject(new Error(`HTTP error ${response.statusCode}`));
response.pipe(file);
file.on('finish', function() {
file.on('finish', () => {
// file.close();
resolve(null);
});
@ -273,12 +273,12 @@ export function fileSha256(filePath: string) {
const shasum = crypto.createHash(algo);
const s = fs.ReadStream(filePath);
s.on('data', function(d: any) { shasum.update(d); });
s.on('end', function() {
s.on('data', (d: any) => { shasum.update(d); });
s.on('end', () => {
const d = shasum.digest('hex');
resolve(d);
});
s.on('error', function(error: any) {
s.on('error', (error: any) => {
reject(error);
});
});
@ -299,7 +299,7 @@ export function fileExists(filePath: string) {
const fs = require('fs-extra');
return new Promise((resolve, reject) => {
fs.stat(filePath, function(error: any) {
fs.stat(filePath, (error: any) => {
if (!error) {
resolve(true);
} else if (error.code === 'ENOENT') {