Skip to content

Commit b97ef18

Browse files
committed
Enable the ESLint no-var ESLint rule in the examples/ folder
Updating the examples to use `let`/`const` should be fine, given that they are available in all browsers/platforms that the PDF.js library now supports; please note the following compatibility information: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const#browser_compatibility
1 parent 276fa4a commit b97ef18

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

examples/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@
88
"pdfjsLib": false,
99
"pdfjsViewer": false,
1010
},
11+
12+
"rules": {
13+
// ECMAScript 6
14+
"no-var": "error",
15+
},
1116
}

examples/mobile-viewer/viewer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const MIN_SCALE = 0.25;
3535
const MAX_SCALE = 10.0;
3636
const DEFAULT_SCALE_VALUE = "auto";
3737

38-
var PDFViewerApplication = {
38+
const PDFViewerApplication = {
3939
pdfLoadingTask: null,
4040
pdfDocument: null,
4141
pdfViewer: null,
@@ -425,6 +425,8 @@ var PDFViewerApplication = {
425425
},
426426
};
427427

428+
window.PDFViewerApplication = PDFViewerApplication;
429+
428430
document.addEventListener(
429431
"DOMContentLoaded",
430432
function () {

examples/node/domstubs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ DOMElementSerializer.prototype = {
188188
this._loopIndex = 0;
189189
/* falls through */
190190
case 5: // Serialize child nodes (only for non-tspan/style elements).
191-
var value;
192191
while (true) {
193-
value = this._childSerializer && this._childSerializer.getNext();
192+
const value =
193+
this._childSerializer && this._childSerializer.getNext();
194194
if (value !== null) {
195195
return value;
196196
}

0 commit comments

Comments
 (0)