Skip to content
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

Enable the ESLint no-var rule in the src/core/evaluator.js file #19050

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable no-var */

import {
AbortException,
Expand Down Expand Up @@ -1887,7 +1886,7 @@ class PartialEvaluator {
);
return;
case OPS.setFont:
var fontSize = args[1];
const fontSize = args[1];
// eagerly collect all fonts
next(
self
Expand All @@ -1913,7 +1912,7 @@ class PartialEvaluator {
parsingText = false;
break;
case OPS.endInlineImage:
var cacheKey = args[0].cacheKey;
const cacheKey = args[0].cacheKey;
if (cacheKey) {
const localImage = localImageCache.getByName(cacheKey);
if (localImage) {
Expand Down Expand Up @@ -1946,8 +1945,8 @@ class PartialEvaluator {
self.ensureStateFont(stateManager.state);
continue;
}
var combinedGlyphs = [];
var state = stateManager.state;
const combinedGlyphs = [],
state = stateManager.state;
for (const arrItem of args[0]) {
if (typeof arrItem === "string") {
combinedGlyphs.push(...self.handleText(arrItem, state));
Expand Down Expand Up @@ -3079,6 +3078,8 @@ class PartialEvaluator {

const operation = {};
let stop,
name,
isValidName,
args = [];
while (!(stop = timeSlotManager.check())) {
// The arguments parsed by read() are not used beyond this loop, so
Expand All @@ -3098,7 +3099,7 @@ class PartialEvaluator {
switch (fn | 0) {
case OPS.setFont:
// Optimization to ignore multiple identical Tf commands.
var fontNameArg = args[0].name,
const fontNameArg = args[0].name,
fontSizeArg = args[1];
if (
textState.font &&
Expand Down Expand Up @@ -3239,12 +3240,10 @@ class PartialEvaluator {
break;
case OPS.paintXObject:
flushTextContentItem();
if (!xobjs) {
xobjs = resources.get("XObject") || Dict.empty;
}
xobjs ??= resources.get("XObject") || Dict.empty;

var isValidName = args[0] instanceof Name;
var name = args[0].name;
isValidName = args[0] instanceof Name;
name = args[0].name;
Snuffleupagus marked this conversation as resolved.
Show resolved Hide resolved

if (isValidName && emptyXObjectCache.getByName(name)) {
break;
Expand Down