Skip to content

Commit

Permalink
Fix remaining linting errors, from enabling the prefer-const ESLint…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
Snuffleupagus committed Dec 27, 2019
1 parent 5d14e68 commit d9a5d50
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1182,15 +1182,15 @@ 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 " +
"the number of pages in the document."
);
return;
}
let i = 0;
// Ignore page labels that correspond to standard page numbering.
while (i < numLabels && labels[i] === (i + 1).toString()) {
i++;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions web/pdf_find_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions web/pdf_link_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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) {
Expand Down

0 comments on commit d9a5d50

Please sign in to comment.