-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Enable the no-var
linting rule in src/core/{cmap,image,worker}.js
#13294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/be7a0a17a4944e3/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://3.101.106.178:8877/32fcaf040c77dc0/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/be7a0a17a4944e3/output.txt Total script time: 25.82 mins
Image differences available at: http://54.67.70.0:8877/be7a0a17a4944e3/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://3.101.106.178:8877/32fcaf040c77dc0/output.txt Total script time: 28.83 mins
Image differences available at: http://3.101.106.178:8877/32fcaf040c77dc0/reftest-analyzer.html#web=eq.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you!
This is done automatically with `gulp lint --fix` and the following manual changes: ```diff diff --git a/src/core/cmap.js b/src/core/cmap.js index 850275a19..8794726 100644 --- a/src/core/cmap.js +++ b/src/core/cmap.js @@ -519,8 +519,8 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { readHexNumber(num, size) { let last; - let stack = this.tmpBuf, - sp = 0; + const stack = this.tmpBuf; + let sp = 0; do { const b = this.readByte(); if (b < 0) { @@ -603,7 +603,6 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { const ucs2DataSize = 1; const subitemsCount = stream.readNumber(); - var i; switch (type) { case 0: // codespacerange stream.readHex(start, dataSize); @@ -614,7 +613,7 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { hexToInt(start, dataSize), hexToInt(end, dataSize) ); - for (i = 1; i < subitemsCount; i++) { + for (let i = 1; i < subitemsCount; i++) { incHex(end, dataSize); stream.readHexNumber(start, dataSize); addHex(start, end, dataSize); @@ -633,7 +632,7 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { addHex(end, start, dataSize); stream.readNumber(); // code // undefined range, skipping - for (i = 1; i < subitemsCount; i++) { + for (let i = 1; i < subitemsCount; i++) { incHex(end, dataSize); stream.readHexNumber(start, dataSize); addHex(start, end, dataSize); @@ -647,7 +646,7 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { stream.readHex(char, dataSize); code = stream.readNumber(); cMap.mapOne(hexToInt(char, dataSize), code); - for (i = 1; i < subitemsCount; i++) { + for (let i = 1; i < subitemsCount; i++) { incHex(char, dataSize); if (!sequence) { stream.readHexNumber(tmp, dataSize); @@ -667,7 +666,7 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { hexToInt(end, dataSize), code ); - for (i = 1; i < subitemsCount; i++) { + for (let i = 1; i < subitemsCount; i++) { incHex(end, dataSize); if (!sequence) { stream.readHexNumber(start, dataSize); @@ -692,7 +691,7 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize) ); - for (i = 1; i < subitemsCount; i++) { + for (let i = 1; i < subitemsCount; i++) { incHex(char, ucs2DataSize); if (!sequence) { stream.readHexNumber(tmp, ucs2DataSize); @@ -717,7 +716,7 @@ const BinaryCMapReader = (function BinaryCMapReaderClosure() { hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize) ); - for (i = 1; i < subitemsCount; i++) { + for (let i = 1; i < subitemsCount; i++) { incHex(end, ucs2DataSize); if (!sequence) { stream.readHexNumber(start, ucs2DataSize); ```
This is done automatically with `gulp lint --fix` and the following manual changes: ```diff diff --git a/src/core/worker.js b/src/core/worker.js index aec9c1d39..f886916 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -300,7 +300,7 @@ class WorkerMessageHandler { cachedChunks = []; }; const readPromise = new Promise(function (resolve, reject) { - var readChunk = function ({ value, done }) { + const readChunk = function ({ value, done }) { try { ensureNotTerminated(); if (done) { ```
This is done automatically with `gulp lint --fix` and the following manual changes: ```diff diff --git a/src/core/image.js b/src/core/image.js index 35c06b8ab..e718b99 100644 --- a/src/core/image.js +++ b/src/core/image.js @@ -97,7 +97,7 @@ class PDFImage { if (isName(filter)) { switch (filter.name) { case "JPXDecode": - var jpxImage = new JpxImage(); + const jpxImage = new JpxImage(); jpxImage.parseImageProperties(image.stream); image.stream.reset(); ```
73967da
to
270e56d
Compare
The commit messages contain more information about the individual changes.