mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Merge pull request #19504 from Snuffleupagus/eslint-fix-arrow-body-style
Fix all outstanding ESLint `arrow-body-style` warnings
This commit is contained in:
commit
426c730e11
5 changed files with 71 additions and 82 deletions
|
@ -106,33 +106,33 @@ async function inlineImages(node, silentErrors = false) {
|
|||
}
|
||||
return response.blob();
|
||||
})
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
.then(blob => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
resolve(reader.result);
|
||||
};
|
||||
reader.onerror = reject;
|
||||
.then(
|
||||
blob =>
|
||||
new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
resolve(reader.result);
|
||||
};
|
||||
reader.onerror = reject;
|
||||
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
})
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
.then(dataUrl => {
|
||||
return new Promise((resolve, reject) => {
|
||||
image.onload = resolve;
|
||||
image.onerror = evt => {
|
||||
if (silentErrors) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
reject(evt);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
})
|
||||
)
|
||||
.then(
|
||||
dataUrl =>
|
||||
new Promise((resolve, reject) => {
|
||||
image.onload = resolve;
|
||||
image.onerror = evt => {
|
||||
if (silentErrors) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
reject(evt);
|
||||
};
|
||||
|
||||
image.src = dataUrl;
|
||||
});
|
||||
})
|
||||
image.src = dataUrl;
|
||||
})
|
||||
)
|
||||
.catch(reason => {
|
||||
throw new Error(`Error inlining image (${url}): ${reason}`);
|
||||
})
|
||||
|
|
|
@ -4110,34 +4110,28 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||
})
|
||||
);
|
||||
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
const result1 = loadingTask1.promise.then(pdfDoc => {
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
return pdfDoc.getPage(1).then(pdfPage => {
|
||||
return pdfPage.getOperatorList().then(opList => {
|
||||
expect(opList.fnArray.length).toBeGreaterThan(100);
|
||||
expect(opList.argsArray.length).toBeGreaterThan(100);
|
||||
expect(opList.lastChunk).toEqual(true);
|
||||
expect(opList.separateAnnots).toEqual(null);
|
||||
const result1 = loadingTask1.promise.then(async pdfDoc => {
|
||||
const pdfPage = await pdfDoc.getPage(1);
|
||||
const opList = await pdfPage.getOperatorList();
|
||||
|
||||
return loadingTask1.destroy();
|
||||
});
|
||||
});
|
||||
expect(opList.fnArray.length).toBeGreaterThan(100);
|
||||
expect(opList.argsArray.length).toBeGreaterThan(100);
|
||||
expect(opList.lastChunk).toEqual(true);
|
||||
expect(opList.separateAnnots).toEqual(null);
|
||||
|
||||
await loadingTask1.destroy();
|
||||
});
|
||||
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
const result2 = loadingTask2.promise.then(pdfDoc => {
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
return pdfDoc.getPage(1).then(pdfPage => {
|
||||
return pdfPage.getOperatorList().then(opList => {
|
||||
expect(opList.fnArray.length).toEqual(0);
|
||||
expect(opList.argsArray.length).toEqual(0);
|
||||
expect(opList.lastChunk).toEqual(true);
|
||||
expect(opList.separateAnnots).toEqual(null);
|
||||
const result2 = loadingTask2.promise.then(async pdfDoc => {
|
||||
const pdfPage = await pdfDoc.getPage(1);
|
||||
const opList = await pdfPage.getOperatorList();
|
||||
|
||||
return loadingTask2.destroy();
|
||||
});
|
||||
});
|
||||
expect(opList.fnArray.length).toEqual(0);
|
||||
expect(opList.argsArray.length).toEqual(0);
|
||||
expect(opList.lastChunk).toEqual(true);
|
||||
expect(opList.separateAnnots).toEqual(null);
|
||||
|
||||
await loadingTask2.destroy();
|
||||
});
|
||||
|
||||
await Promise.all([result1, result2]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue