Skip to content

Commit

Permalink
Re-format the code to account for prettier and globals updates
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Snuffleupagus authored and pull[bot] committed Jul 28, 2024
1 parent 6c1e808 commit 1690428
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 34 deletions.
5 changes: 2 additions & 3 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,8 @@ class Page {
}

async getStructTree() {
const structTreeRoot = await this.pdfManager.ensureCatalog(
"structTreeRoot"
);
const structTreeRoot =
await this.pdfManager.ensureCatalog("structTreeRoot");
if (!structTreeRoot) {
return null;
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ async function writeStream(stream, buffer, transform) {
const MIN_LENGTH_FOR_COMPRESSING = 256;

if (
// eslint-disable-next-line no-undef
typeof CompressionStream !== "undefined" &&
(string.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode)
) {
try {
const byteArray = stringToBytes(string);
// eslint-disable-next-line no-undef
const cs = new CompressionStream("deflate");
const writer = cs.writable.getWriter();
writer.write(byteArray);
Expand Down
45 changes: 18 additions & 27 deletions test/unit/pdf_find_controller_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,8 @@ describe("pdf_find_controller", function () {
pending("Linked test-cases are not supported in Node.js.");
}

const { eventBus, pdfFindController } = await initPdfFindController(
"issue14562.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("issue14562.pdf");

await testSearch({
eventBus,
Expand Down Expand Up @@ -762,9 +761,8 @@ describe("pdf_find_controller", function () {
});

it("performs a search in a text containing some Hangul syllables", async function () {
const { eventBus, pdfFindController } = await initPdfFindController(
"bug1771477.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("bug1771477.pdf");

await testSearch({
eventBus,
Expand All @@ -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 () {
const { eventBus, pdfFindController } = await initPdfFindController(
"issue15340.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("issue15340.pdf");

await testSearch({
eventBus,
Expand All @@ -804,9 +801,8 @@ describe("pdf_find_controller", function () {
});

it("performs a search in a text containing fullwidth chars", async function () {
const { eventBus, pdfFindController } = await initPdfFindController(
"issue15690.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("issue15690.pdf");

await testSearch({
eventBus,
Expand All @@ -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 () {
const { eventBus, pdfFindController } = await initPdfFindController(
"issue15759.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("issue15759.pdf");

await testSearch({
eventBus,
Expand Down Expand Up @@ -862,9 +857,8 @@ describe("pdf_find_controller", function () {
pending("Linked test-cases are not supported in Node.js.");
}

const { eventBus, pdfFindController } = await initPdfFindController(
"issue12909.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("issue12909.pdf");

await testSearch({
eventBus,
Expand Down Expand Up @@ -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 () {
const { eventBus, pdfFindController } = await initPdfFindController(
"issue16063.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("issue16063.pdf");

await testSearch({
eventBus,
Expand Down Expand Up @@ -936,9 +929,8 @@ describe("pdf_find_controller", function () {
pending("Linked test-cases are not supported in Node.js.");
}

const { eventBus, pdfFindController } = await initPdfFindController(
"bug1820909.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("bug1820909.pdf");

await testSearch({
eventBus,
Expand All @@ -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 () {
const { eventBus, pdfFindController } = await initPdfFindController(
"bug1820909.1.pdf"
);
const { eventBus, pdfFindController } =
await initPdfFindController("bug1820909.1.pdf");

await testSearch({
eventBus,
Expand Down
4 changes: 2 additions & 2 deletions web/pdf_link_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ class PDFLinkService {
*/
async executeSetOCGState(action) {
const pdfDocument = this.pdfDocument;
const optionalContentConfig = await this.pdfViewer
.optionalContentConfigPromise;
const optionalContentConfig =
await this.pdfViewer.optionalContentConfigPromise;

if (pdfDocument !== this.pdfDocument) {
return; // The document was closed while the optional content resolved.
Expand Down

0 comments on commit 1690428

Please sign in to comment.