Fix remaining linting errors, from enabling the prefer-const ESLint rule in the web/ directory

This covers the handful of cases that the `--fix` command couldn't deal with, and the changes aren't just fixing the linting errors but attempt to slightly improve the relevant code.
This commit is contained in:
Jonas Jenwald 2019-12-27 00:32:40 +01:00
parent 5d14e68bec
commit d9a5d50664
3 changed files with 10 additions and 11 deletions

View File

@ -1182,8 +1182,7 @@ const PDFViewerApplication = {
if (!labels || AppOptions.get("disablePageLabels")) {
return;
}
let i = 0,
numLabels = labels.length;
const numLabels = labels.length;
if (numLabels !== this.pagesCount) {
console.error(
"The number of Page Labels does not match " +
@ -1191,6 +1190,7 @@ const PDFViewerApplication = {
);
return;
}
let i = 0;
// Ignore page labels that correspond to standard page numbering.
while (i < numLabels && labels[i] === (i + 1).toString()) {
i++;
@ -2004,10 +2004,9 @@ function webViewerTextLayerRendered(evt) {
}
}
function webViewerPageMode(evt) {
function webViewerPageMode({ mode }) {
// Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`.
let mode = evt.mode,
view;
let view;
switch (mode) {
case "thumbs":
view = SidebarView.THUMBS;

View File

@ -153,8 +153,8 @@ class PDFFindBar {
if (!this.findResultsCount) {
return; // No UI control is provided.
}
let matchesCountMsg = "",
limit = MATCHES_COUNT_LIMIT;
const limit = MATCHES_COUNT_LIMIT;
let matchesCountMsg = "";
if (total > 0) {
if (total > limit) {

View File

@ -108,8 +108,8 @@ class PDFLinkService {
navigateTo(dest) {
const goToDestination = ({ namedDest, explicitDest }) => {
// Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>
let destRef = explicitDest[0],
pageNumber;
const destRef = explicitDest[0];
let pageNumber;
if (destRef instanceof Object) {
pageNumber = this._cachedPageNumber(destRef);
@ -405,8 +405,7 @@ function isValidExplicitDestination(dest) {
if (!Array.isArray(dest)) {
return false;
}
let destLength = dest.length,
allowNull = true;
const destLength = dest.length;
if (destLength < 2) {
return false;
}
@ -425,6 +424,7 @@ function isValidExplicitDestination(dest) {
if (!(typeof zoom === "object" && typeof zoom.name === "string")) {
return false;
}
let allowNull = true;
switch (zoom.name) {
case "XYZ":
if (destLength !== 5) {