Re-format the code to account for prettier and globals updates

The `prettier` update slightly changed the formatting of some await-expressions; please see https://github.com/prettier/prettier/blob/main/CHANGELOG.md#302

The `globals` update removed the need for some eslint-disable statements; please see https://github.com/sindresorhus/globals/releases/tag/v13.21.0
This commit is contained in:
Jonas Jenwald 2023-08-19 09:08:54 +02:00
parent c5ebfa51a7
commit 4d19db0b19
4 changed files with 22 additions and 34 deletions

View File

@ -646,9 +646,8 @@ class Page {
} }
async getStructTree() { async getStructTree() {
const structTreeRoot = await this.pdfManager.ensureCatalog( const structTreeRoot =
"structTreeRoot" await this.pdfManager.ensureCatalog("structTreeRoot");
);
if (!structTreeRoot) { if (!structTreeRoot) {
return null; return null;
} }

View File

@ -63,13 +63,11 @@ async function writeStream(stream, buffer, transform) {
const MIN_LENGTH_FOR_COMPRESSING = 256; const MIN_LENGTH_FOR_COMPRESSING = 256;
if ( if (
// eslint-disable-next-line no-undef
typeof CompressionStream !== "undefined" && typeof CompressionStream !== "undefined" &&
(string.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode) (string.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode)
) { ) {
try { try {
const byteArray = stringToBytes(string); const byteArray = stringToBytes(string);
// eslint-disable-next-line no-undef
const cs = new CompressionStream("deflate"); const cs = new CompressionStream("deflate");
const writer = cs.writable.getWriter(); const writer = cs.writable.getWriter();
writer.write(byteArray); writer.write(byteArray);

View File

@ -722,9 +722,8 @@ describe("pdf_find_controller", function () {
pending("Linked test-cases are not supported in Node.js."); pending("Linked test-cases are not supported in Node.js.");
} }
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"issue14562.pdf" await initPdfFindController("issue14562.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -762,9 +761,8 @@ describe("pdf_find_controller", function () {
}); });
it("performs a search in a text containing some Hangul syllables", async function () { it("performs a search in a text containing some Hangul syllables", async function () {
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"bug1771477.pdf" await initPdfFindController("bug1771477.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -783,9 +781,8 @@ describe("pdf_find_controller", function () {
}); });
it("performs a search in a text containing an ideographic at the end of a line", async function () { it("performs a search in a text containing an ideographic at the end of a line", async function () {
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"issue15340.pdf" await initPdfFindController("issue15340.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -804,9 +801,8 @@ describe("pdf_find_controller", function () {
}); });
it("performs a search in a text containing fullwidth chars", async function () { it("performs a search in a text containing fullwidth chars", async function () {
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"issue15690.pdf" await initPdfFindController("issue15690.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -825,9 +821,8 @@ describe("pdf_find_controller", function () {
}); });
it("performs a search in a text with some Katakana at the end of a line", async function () { it("performs a search in a text with some Katakana at the end of a line", async function () {
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"issue15759.pdf" await initPdfFindController("issue15759.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -862,9 +857,8 @@ describe("pdf_find_controller", function () {
pending("Linked test-cases are not supported in Node.js."); pending("Linked test-cases are not supported in Node.js.");
} }
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"issue12909.pdf" await initPdfFindController("issue12909.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -896,9 +890,8 @@ describe("pdf_find_controller", function () {
}); });
it("performs a search in a text with some Hiragana diacritics at the end of a line", async function () { it("performs a search in a text with some Hiragana diacritics at the end of a line", async function () {
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"issue16063.pdf" await initPdfFindController("issue16063.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -936,9 +929,8 @@ describe("pdf_find_controller", function () {
pending("Linked test-cases are not supported in Node.js."); pending("Linked test-cases are not supported in Node.js.");
} }
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"bug1820909.pdf" await initPdfFindController("bug1820909.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,
@ -957,9 +949,8 @@ describe("pdf_find_controller", function () {
}); });
it("performs a search in a text with some UTF-32 chars followed by a dash at the end of a line", async function () { it("performs a search in a text with some UTF-32 chars followed by a dash at the end of a line", async function () {
const { eventBus, pdfFindController } = await initPdfFindController( const { eventBus, pdfFindController } =
"bug1820909.1.pdf" await initPdfFindController("bug1820909.1.pdf");
);
await testSearch({ await testSearch({
eventBus, eventBus,

View File

@ -505,8 +505,8 @@ class PDFLinkService {
*/ */
async executeSetOCGState(action) { async executeSetOCGState(action) {
const pdfDocument = this.pdfDocument; const pdfDocument = this.pdfDocument;
const optionalContentConfig = await this.pdfViewer const optionalContentConfig =
.optionalContentConfigPromise; await this.pdfViewer.optionalContentConfigPromise;
if (pdfDocument !== this.pdfDocument) { if (pdfDocument !== this.pdfDocument) {
return; // The document was closed while the optional content resolved. return; // The document was closed while the optional content resolved.