Skip to content

Commit 223c429

Browse files
committed
Fix inconsistent spacing and trailing commas in objects in web/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on
http://eslint.org/docs/rules/comma-dangle http://eslint.org/docs/rules/object-curly-spacing Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead. *Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch. ```diff diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js index 002dbf29..1de4e53 100644 --- a/web/pdf_thumbnail_view.js +++ b/web/pdf_thumbnail_view.js @@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() { setPageLabel: function PDFThumbnailView_setPageLabel(label) { this.pageLabel = (typeof label === 'string' ? label : null); - this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}'). - then((msg) => { + this.l10n.get('thumb_page_title', { page: this.pageId, }, + 'Page {{page}}').then((msg) => { this.anchor.title = msg; }); diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js index 160e0410..6495fc5 100644 --- a/web/secondary_toolbar.js +++ b/web/secondary_toolbar.js @@ -65,7 +65,8 @@ class SecondaryToolbar { { element: options.printButton, eventName: 'print', close: true, }, { element: options.downloadButton, eventName: 'download', close: true, }, { element: options.viewBookmarkButton, eventName: null, close: true, }, - { element: options.firstPageButton, eventName: 'firstpage', close: true, }, + { element: options.firstPageButton, eventName: 'firstpage', + close: true, }, { element: options.lastPageButton, eventName: 'lastpage', close: true, }, { element: options.pageRotateCwButton, eventName: 'rotatecw', close: false, }, @@ -76,7 +77,7 @@ class SecondaryToolbar { { element: options.cursorHandToolButton, eventName: 'switchcursortool', eventDetails: { tool: CursorTool.HAND, }, close: true, }, { element: options.documentPropertiesButton, - eventName: 'documentproperties', close: true, } + eventName: 'documentproperties', close: true, }, ]; this.items = { firstPage: options.firstPageButton, ```
1 parent bb7e85c commit 223c429

26 files changed

+125
-124
lines changed

web/annotation_layer_builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AnnotationLayerBuilder {
4949
render(viewport, intent = 'display') {
5050
this.pdfPage.getAnnotations({ intent, }).then((annotations) => {
5151
var parameters = {
52-
viewport: viewport.clone({ dontFlip: true }),
52+
viewport: viewport.clone({ dontFlip: true, }),
5353
div: this.div,
5454
annotations,
5555
page: this.pdfPage,

web/app.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
import {
2323
build, createBlob, getDocument, getFilenameFromUrl, InvalidPDFException,
2424
MissingPDFException, OPS, PDFJS, shadow, UnexpectedResponseException,
25-
UNSUPPORTED_FEATURES, version,
25+
UNSUPPORTED_FEATURES, version
2626
} from 'pdfjs-lib';
2727
import { CursorTool, PDFCursorTools } from './pdf_cursor_tools';
2828
import { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';
@@ -329,7 +329,7 @@ var PDFViewerApplication = {
329329
container: thumbnailContainer,
330330
renderingQueue: pdfRenderingQueue,
331331
linkService: pdfLinkService,
332-
l10n: this.l10n
332+
l10n: this.l10n,
333333
});
334334
pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
335335

@@ -389,7 +389,7 @@ var PDFViewerApplication = {
389389
viewer,
390390
pdfViewer: this.pdfViewer,
391391
eventBus,
392-
contextMenuItems: appConfig.fullscreen
392+
contextMenuItems: appConfig.fullscreen,
393393
});
394394
}
395395

@@ -543,7 +543,7 @@ var PDFViewerApplication = {
543543
},
544544
onProgress(loaded, total) {
545545
PDFViewerApplication.progress(loaded / total);
546-
}
546+
},
547547
});
548548
} else {
549549
throw new Error('Not implemented: initPassiveLoading');
@@ -779,25 +779,25 @@ var PDFViewerApplication = {
779779
*/
780780
error: function pdfViewError(message, moreInfo) {
781781
let moreInfoText = [this.l10n.get('error_version_info',
782-
{version: version || '?', build: build || '?'},
782+
{ version: version || '?', build: build || '?', },
783783
'PDF.js v{{version}} (build: {{build}})')];
784784
if (moreInfo) {
785785
moreInfoText.push(
786-
this.l10n.get('error_message', {message: moreInfo.message},
786+
this.l10n.get('error_message', { message: moreInfo.message, },
787787
'Message: {{message}}'));
788788
if (moreInfo.stack) {
789789
moreInfoText.push(
790-
this.l10n.get('error_stack', {stack: moreInfo.stack},
790+
this.l10n.get('error_stack', { stack: moreInfo.stack, },
791791
'Stack: {{stack}}'));
792792
} else {
793793
if (moreInfo.filename) {
794794
moreInfoText.push(
795-
this.l10n.get('error_file', {file: moreInfo.filename},
795+
this.l10n.get('error_file', { file: moreInfo.filename, },
796796
'File: {{file}}'));
797797
}
798798
if (moreInfo.lineNumber) {
799799
moreInfoText.push(
800-
this.l10n.get('error_line', {line: moreInfo.lineNumber},
800+
this.l10n.get('error_line', { line: moreInfo.lineNumber, },
801801
'Line: {{line}}'));
802802
}
803803
}
@@ -1133,7 +1133,7 @@ var PDFViewerApplication = {
11331133
this.initialDestination = null;
11341134
} else if (this.initialBookmark) {
11351135
this.pdfLinkService.setHash(this.initialBookmark);
1136-
this.pdfHistory.push({ hash: this.initialBookmark }, true);
1136+
this.pdfHistory.push({ hash: this.initialBookmark, }, true);
11371137
this.initialBookmark = null;
11381138
} else if (storedHash) {
11391139
this.pdfLinkService.setHash(storedHash);
@@ -1215,7 +1215,7 @@ var PDFViewerApplication = {
12151215
if (typeof PDFJSDev !== 'undefined' &&
12161216
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
12171217
this.externalServices.reportTelemetry({
1218-
type: 'print'
1218+
type: 'print',
12191219
});
12201220
}
12211221
},
@@ -1608,7 +1608,7 @@ function webViewerPageRendered(e) {
16081608
if (typeof PDFJSDev !== 'undefined' &&
16091609
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
16101610
PDFViewerApplication.externalServices.reportTelemetry({
1611-
type: 'pageInfo'
1611+
type: 'pageInfo',
16121612
});
16131613
// It is a good time to report stream and font types.
16141614
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
@@ -1851,7 +1851,7 @@ function webViewerFind(e) {
18511851
phraseSearch: e.phraseSearch,
18521852
caseSensitive: e.caseSensitive,
18531853
highlightAll: e.highlightAll,
1854-
findPrevious: e.findPrevious
1854+
findPrevious: e.findPrevious,
18551855
});
18561856
}
18571857

@@ -1861,7 +1861,7 @@ function webViewerFindFromUrlHash(e) {
18611861
phraseSearch: e.phraseSearch,
18621862
caseSensitive: false,
18631863
highlightAll: true,
1864-
findPrevious: false
1864+
findPrevious: false,
18651865
});
18661866
}
18671867

@@ -1989,7 +1989,7 @@ function webViewerKeyDown(evt) {
19891989
phraseSearch: findState.phraseSearch,
19901990
caseSensitive: findState.caseSensitive,
19911991
highlightAll: findState.highlightAll,
1992-
findPrevious: cmd === 5 || cmd === 12
1992+
findPrevious: cmd === 5 || cmd === 12,
19931993
});
19941994
}
19951995
handled = true;
@@ -2241,8 +2241,8 @@ var PDFPrintServiceFactory = {
22412241
supportsPrinting: false,
22422242
createPrintService() {
22432243
throw new Error('Not implemented: createPrintService');
2244-
}
2245-
}
2244+
},
2245+
},
22462246
};
22472247

22482248
export {

web/chromecom.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function requestAccessToLocalFile(fileUrl, overlayManager) {
208208
// checkbox causes the extension to reload, and Chrome will close all
209209
// tabs upon reload.
210210
ChromeCom.request('openExtensionsPageForFileAccess', {
211-
newTab: e.ctrlKey || e.metaKey || e.button === 1 || window !== top
211+
newTab: e.ctrlKey || e.metaKey || e.button === 1 || window !== top,
212212
});
213213
};
214214

@@ -254,14 +254,14 @@ function setReferer(url, callback) {
254254
if (!port) {
255255
// The background page will accept the port, and keep adding the Referer
256256
// request header to requests to |url| until the port is disconnected.
257-
port = chrome.runtime.connect({name: 'chromecom-referrer'});
257+
port = chrome.runtime.connect({ name: 'chromecom-referrer', });
258258
}
259259
port.onDisconnect.addListener(onDisconnect);
260260
port.onMessage.addListener(onMessage);
261261
// Initiate the information exchange.
262262
port.postMessage({
263263
referer: window.history.state && window.history.state.chromecomState,
264-
requestUrl: url
264+
requestUrl: url,
265265
});
266266

267267
function onMessage(referer) {

web/debugger.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var FontInspector = (function FontInspectorClosure() {
119119
download.href = url[1];
120120
} else if (fontObj.data) {
121121
url = URL.createObjectURL(new Blob([fontObj.data], {
122-
type: fontObj.mimeType
122+
type: fontObj.mimeType,
123123
}));
124124
download.href = url;
125125
}
@@ -154,7 +154,7 @@ var FontInspector = (function FontInspectorClosure() {
154154
resetSelection();
155155
}
156156
}, 2000);
157-
}
157+
},
158158
};
159159
})();
160160

@@ -243,7 +243,7 @@ var StepperManager = (function StepperManagerClosure() {
243243
saveBreakPoints: function saveBreakPoints(pageIndex, bps) {
244244
breakPoints[pageIndex] = bps;
245245
sessionStorage.setItem('pdfjsBreakPoints', JSON.stringify(breakPoints));
246-
}
246+
},
247247
};
248248
})();
249249

@@ -433,7 +433,7 @@ var Stepper = (function StepperClosure() {
433433
row.style.backgroundColor = null;
434434
}
435435
}
436-
}
436+
},
437437
};
438438
return Stepper;
439439
})();
@@ -497,7 +497,7 @@ var Stats = (function Stats() {
497497
cleanup() {
498498
stats = [];
499499
clear(this.panel);
500-
}
500+
},
501501
};
502502
})();
503503

@@ -615,6 +615,6 @@ window.PDFBug = (function PDFBugClosure() {
615615
tools[j].panel.setAttribute('hidden', 'true');
616616
}
617617
}
618-
}
618+
},
619619
};
620620
})();

web/dom_events.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function attachDOMEventsToEventBus(eventBus) {
3434
eventBus.on('textlayerrendered', function (e) {
3535
var event = document.createEvent('CustomEvent');
3636
event.initCustomEvent('textlayerrendered', true, true, {
37-
pageNumber: e.pageNumber
37+
pageNumber: e.pageNumber,
3838
});
3939
e.source.textLayerDiv.dispatchEvent(event);
4040
});
@@ -52,7 +52,7 @@ function attachDOMEventsToEventBus(eventBus) {
5252
eventBus.on('pagesloaded', function (e) {
5353
var event = document.createEvent('CustomEvent');
5454
event.initCustomEvent('pagesloaded', true, true, {
55-
pagesCount: e.pagesCount
55+
pagesCount: e.pagesCount,
5656
});
5757
e.source.container.dispatchEvent(event);
5858
});
@@ -79,14 +79,14 @@ function attachDOMEventsToEventBus(eventBus) {
7979
phraseSearch: e.phraseSearch,
8080
caseSensitive: e.caseSensitive,
8181
highlightAll: e.highlightAll,
82-
findPrevious: e.findPrevious
82+
findPrevious: e.findPrevious,
8383
});
8484
window.dispatchEvent(event);
8585
});
8686
eventBus.on('attachmentsloaded', function (e) {
8787
var event = document.createEvent('CustomEvent');
8888
event.initCustomEvent('attachmentsloaded', true, true, {
89-
attachmentsCount: e.attachmentsCount
89+
attachmentsCount: e.attachmentsCount,
9090
});
9191
e.source.container.dispatchEvent(event);
9292
});
@@ -107,22 +107,22 @@ function attachDOMEventsToEventBus(eventBus) {
107107
eventBus.on('namedaction', function (e) {
108108
var event = document.createEvent('CustomEvent');
109109
event.initCustomEvent('namedaction', true, true, {
110-
action: e.action
110+
action: e.action,
111111
});
112112
e.source.pdfViewer.container.dispatchEvent(event);
113113
});
114114
eventBus.on('presentationmodechanged', function (e) {
115115
var event = document.createEvent('CustomEvent');
116116
event.initCustomEvent('presentationmodechanged', true, true, {
117117
active: e.active,
118-
switchInProgress: e.switchInProgress
118+
switchInProgress: e.switchInProgress,
119119
});
120120
window.dispatchEvent(event);
121121
});
122122
eventBus.on('outlineloaded', function (e) {
123123
var event = document.createEvent('CustomEvent');
124124
event.initCustomEvent('outlineloaded', true, true, {
125-
outlineCount: e.outlineCount
125+
outlineCount: e.outlineCount,
126126
});
127127
e.source.container.dispatchEvent(event);
128128
});

web/download_manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ DownloadManager.prototype = {
6969
downloadData: function DownloadManager_downloadData(data, filename,
7070
contentType) {
7171
if (navigator.msSaveBlob) { // IE10 and above
72-
return navigator.msSaveBlob(new Blob([data], { type: contentType }),
72+
return navigator.msSaveBlob(new Blob([data], { type: contentType, }),
7373
filename);
7474
}
7575

@@ -95,7 +95,7 @@ DownloadManager.prototype = {
9595

9696
var blobUrl = URL.createObjectURL(blob);
9797
download(blobUrl, filename);
98-
}
98+
},
9999
};
100100

101101
export {

web/firefox_print_service.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function composePage(pdfDocument, pageNumber, size, printContainer) {
4949
canvasContext: ctx,
5050
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
5151
viewport: pdfPage.getViewport(1, size.rotation),
52-
intent: 'print'
52+
intent: 'print',
5353
};
5454
return pdfPage.render(renderContext).promise;
5555
}).then(function() {
@@ -88,7 +88,7 @@ FirefoxPrintService.prototype = {
8888

8989
destroy() {
9090
this.printContainer.textContent = '';
91-
}
91+
},
9292
};
9393

9494
PDFPrintServiceFactory.instance = {
@@ -101,7 +101,7 @@ PDFPrintServiceFactory.instance = {
101101

102102
createPrintService(pdfDocument, pagesOverview, printContainer) {
103103
return new FirefoxPrintService(pdfDocument, pagesOverview, printContainer);
104-
}
104+
},
105105
};
106106

107107
export {

web/firefoxcom.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ var FirefoxCom = (function FirefoxComClosure() {
7575
action,
7676
data,
7777
sync: false,
78-
responseExpected: !!callback
78+
responseExpected: !!callback,
7979
});
8080
return request.dispatchEvent(sender);
81-
}
81+
},
8282
};
8383
})();
8484

@@ -101,7 +101,7 @@ var DownloadManager = (function DownloadManagerClosure() {
101101
blobUrl,
102102
originalUrl: blobUrl,
103103
filename,
104-
isAttachment: true
104+
isAttachment: true,
105105
});
106106
},
107107

@@ -119,7 +119,7 @@ var DownloadManager = (function DownloadManagerClosure() {
119119
originalUrl: url,
120120
filename,
121121
}, onResponse);
122-
}
122+
},
123123
};
124124

125125
return DownloadManager;
@@ -179,7 +179,7 @@ class MozL10n {
179179
phraseSearch: true,
180180
caseSensitive: !!evt.detail.caseSensitive,
181181
highlightAll: !!evt.detail.highlightAll,
182-
findPrevious: !!evt.detail.findPrevious
182+
findPrevious: !!evt.detail.findPrevious,
183183
});
184184
};
185185

@@ -305,7 +305,7 @@ document.mozL10n.setExternalLocalizerServices({
305305

306306
getStrings(key) {
307307
return FirefoxCom.requestSync('getStrings', key);
308-
}
308+
},
309309
});
310310

311311
export {

web/grab_to_pan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ GrabToPan.prototype = {
175175
this.document.removeEventListener('mouseup', this._endPan, true);
176176
// Note: ChildNode.remove doesn't throw if the parentNode is undefined.
177177
this.overlay.remove();
178-
}
178+
},
179179
};
180180

181181
// Get the correct (vendor-prefixed) name of the matches method.

0 commit comments

Comments
 (0)