mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Enable the arrow-body-style
ESLint rule
This manually ignores some cases where the resulting auto-formatting would not, as far as I'm concerned, constitute a readability improvement or where we'd just end up with more overall indentation. Please see https://eslint.org/docs/latest/rules/arrow-body-style
This commit is contained in:
parent
998184a00e
commit
f9a384d711
20 changed files with 78 additions and 82 deletions
|
@ -106,6 +106,7 @@ 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();
|
||||
|
@ -117,6 +118,7 @@ async function inlineImages(node, silentErrors = false) {
|
|||
reader.readAsDataURL(blob);
|
||||
});
|
||||
})
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
.then(dataUrl => {
|
||||
return new Promise((resolve, reject) => {
|
||||
image.onload = resolve;
|
||||
|
|
|
@ -38,8 +38,8 @@ const getXY = (page, selector) =>
|
|||
return `${bbox.x}::${bbox.y}`;
|
||||
}, selector);
|
||||
|
||||
const getSpanRectFromText = (page, pageNumber, text) => {
|
||||
return page.evaluate(
|
||||
const getSpanRectFromText = (page, pageNumber, text) =>
|
||||
page.evaluate(
|
||||
(number, content) => {
|
||||
for (const el of document.querySelectorAll(
|
||||
`.page[data-page-number="${number}"] > .textLayer > span`
|
||||
|
@ -54,7 +54,6 @@ const getSpanRectFromText = (page, pageNumber, text) => {
|
|||
pageNumber,
|
||||
text
|
||||
);
|
||||
};
|
||||
|
||||
describe("Highlight Editor", () => {
|
||||
describe("Editor must be removed without exception", () => {
|
||||
|
|
|
@ -265,9 +265,10 @@ async function serializeBitmapDimensions(page) {
|
|||
const { map } =
|
||||
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable;
|
||||
return map
|
||||
? Array.from(map.values(), x => {
|
||||
return { width: x.bitmap.width, height: x.bitmap.height };
|
||||
})
|
||||
? Array.from(map.values(), x => ({
|
||||
width: x.bitmap.width,
|
||||
height: x.bitmap.height,
|
||||
}))
|
||||
: [];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2689,9 +2689,7 @@ describe("api", function () {
|
|||
|
||||
const viewPromises = [];
|
||||
for (let i = 0; i < numPages; i++) {
|
||||
viewPromises[i] = pdfDoc.getPage(i + 1).then(pdfPage => {
|
||||
return pdfPage.view;
|
||||
});
|
||||
viewPromises[i] = pdfDoc.getPage(i + 1).then(pdfPage => pdfPage.view);
|
||||
}
|
||||
|
||||
const [page1, page2, page3] = await Promise.all(viewPromises);
|
||||
|
@ -3412,7 +3410,9 @@ 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);
|
||||
|
@ -3425,7 +3425,9 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||
});
|
||||
});
|
||||
|
||||
// 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);
|
||||
|
|
|
@ -152,14 +152,12 @@ describe("Scripting", function () {
|
|||
});
|
||||
|
||||
it("should get field using a path", async () => {
|
||||
const base = value => {
|
||||
return {
|
||||
id: getId(),
|
||||
value,
|
||||
actions: {},
|
||||
type: "text",
|
||||
};
|
||||
};
|
||||
const base = value => ({
|
||||
id: getId(),
|
||||
value,
|
||||
actions: {},
|
||||
type: "text",
|
||||
});
|
||||
const data = {
|
||||
objects: {
|
||||
A: [base(1)],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue