Skip to content

Commit

Permalink
Merge pull request #19503 from Snuffleupagus/web-rm-some-eslint-disable
Browse files Browse the repository at this point in the history
Remove a few `eslint-disable` statements in the `web/` folder
  • Loading branch information
Snuffleupagus authored Feb 17, 2025
2 parents 2df0f92 + a2d15ce commit affce70
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 33 deletions.
10 changes: 2 additions & 8 deletions web/generic_scripting.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ import { getPdfFilenameFromUrl } from "pdfjs-lib";
async function docProperties(pdfDocument) {
const url = "",
baseUrl = url.split("#", 1)[0];
// eslint-disable-next-line prefer-const
let { info, metadata, contentDispositionFilename, contentLength } =
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();

if (!contentLength) {
const { length } = await pdfDocument.getDownloadInfo();
contentLength = length;
}

return {
...info,
baseURL: baseUrl,
filesize: contentLength,
filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,
filename: contentDispositionFilename || getPdfFilenameFromUrl(url),
metadata: metadata?.getRaw(),
authors: metadata?.get("dc:creator"),
Expand Down
9 changes: 4 additions & 5 deletions web/pdf_find_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,8 @@ class PDFFindController {
const { promise, resolve } = Promise.withResolvers();
this._extractTextPromises[i] = promise;

// eslint-disable-next-line arrow-body-style
deferred = deferred.then(() => {
return this._pdfDocument
deferred = deferred.then(() =>
this._pdfDocument
.getPage(i + 1)
.then(pdfPage => pdfPage.getTextContent(textOptions))
.then(
Expand Down Expand Up @@ -921,8 +920,8 @@ class PDFFindController {
this._hasDiacritics[i] = false;
resolve();
}
);
});
)
);
}
}

Expand Down
38 changes: 18 additions & 20 deletions web/pdf_print_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,27 +260,25 @@ window.print = function () {
ensureOverlay().then(function () {
overlayManager.closeIfActive(dialog);
});
return; // eslint-disable-line no-unsafe-finally
} else {
const activeServiceOnEntry = activeService;
activeService
.renderPages()
.then(() => activeServiceOnEntry.performPrint())
.catch(() => {
// Ignore any error messages.
})
.then(() => {
// aborts acts on the "active" print request, so we need to check
// whether the print request (activeServiceOnEntry) is still active.
// Without the check, an unrelated print request (created after
// aborting this print request while the pages were being generated)
// would be aborted.
if (activeServiceOnEntry.active) {
abort();
}
});
}
const activeServiceOnEntry = activeService;
activeService
.renderPages()
.then(function () {
return activeServiceOnEntry.performPrint();
})
.catch(function () {
// Ignore any error messages.
})
.then(function () {
// aborts acts on the "active" print request, so we need to check
// whether the print request (activeServiceOnEntry) is still active.
// Without the check, an unrelated print request (created after aborting
// this print request while the pages were being generated) would be
// aborted.
if (activeServiceOnEntry.active) {
abort();
}
});
}
};

Expand Down

0 comments on commit affce70

Please sign in to comment.