Fix inconsistent spacing and trailing commas in objects in remaining src/ 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 *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/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
       var map = [];
       for (var i = 0, ii = positions.length; i < ii; i += 2) {
         map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
-                 positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+                   positions[i + 1]], x: 0, y: 0, w: width, h: height, });
       }
       this.paintInlineImageXObjectGroup(imgData, map);
     },
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {

       for (var x = 0; x < fnArrayLen; x++) {
         var fnId = fnArray[x];
-        opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+        opList.push({
+          'fnId': fnId,
+          'fn': REVOPS[fnId],
+          'args': argsArray[x],
+        });
       }
       return opListToTree(opList);
     },
```
This commit is contained in:
Jonas Jenwald 2017-06-02 11:26:37 +02:00
parent 593dec1bb7
commit f20d2cd2ae
12 changed files with 144 additions and 140 deletions

View file

@ -26,7 +26,7 @@ var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
const NativeImageDecoding = {
NONE: 'none',
DECODE: 'decode',
DISPLAY: 'display'
DISPLAY: 'display',
};
var TextRenderingMode = {
@ -39,13 +39,13 @@ var TextRenderingMode = {
FILL_STROKE_ADD_TO_PATH: 6,
ADD_TO_PATH: 7,
FILL_STROKE_MASK: 3,
ADD_TO_PATH_FLAG: 4
ADD_TO_PATH_FLAG: 4,
};
var ImageKind = {
GRAYSCALE_1BPP: 1,
RGB_24BPP: 2,
RGBA_32BPP: 3
RGBA_32BPP: 3,
};
var AnnotationType = {
@ -74,7 +74,7 @@ var AnnotationType = {
TRAPNET: 23,
WATERMARK: 24,
THREED: 25,
REDACT: 26
REDACT: 26,
};
var AnnotationFlag = {
@ -87,7 +87,7 @@ var AnnotationFlag = {
READONLY: 0x40,
LOCKED: 0x80,
TOGGLENOVIEW: 0x100,
LOCKEDCONTENTS: 0x200
LOCKEDCONTENTS: 0x200,
};
var AnnotationFieldFlag = {
@ -117,7 +117,7 @@ var AnnotationBorderStyleType = {
DASHED: 2,
BEVELED: 3,
INSET: 4,
UNDERLINE: 5
UNDERLINE: 5,
};
var StreamType = {
@ -130,7 +130,7 @@ var StreamType = {
A85: 6,
AHX: 7,
CCF: 8,
RL: 9
RL: 9,
};
var FontType = {
@ -144,13 +144,13 @@ var FontType = {
TYPE3: 7,
OPENTYPE: 8,
TYPE0: 9,
MMTYPE1: 10
MMTYPE1: 10,
};
var VERBOSITY_LEVELS = {
errors: 0,
warnings: 1,
infos: 5
infos: 5,
};
var CMapCompressionType = {
@ -253,7 +253,7 @@ var OPS = {
paintImageXObjectRepeat: 88,
paintImageMaskXObjectRepeat: 89,
paintSolidColorImageMask: 90,
constructPath: 91
constructPath: 91,
};
var verbosity = VERBOSITY_LEVELS.warnings;
@ -317,7 +317,7 @@ var UNSUPPORTED_FEATURES = {
javaScript: 'javaScript',
smask: 'smask',
shadingPattern: 'shadingPattern',
font: 'font'
font: 'font',
};
// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
@ -375,7 +375,7 @@ function shadow(obj, prop, value) {
Object.defineProperty(obj, prop, { value,
enumerable: true,
configurable: true,
writable: false });
writable: false, });
return value;
}
@ -393,7 +393,7 @@ function getLookupTableFactory(initializer) {
var PasswordResponses = {
NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2
INCORRECT_PASSWORD: 2,
};
var PasswordException = (function PasswordExceptionClosure() {
@ -1011,7 +1011,7 @@ var PageViewport = (function PageViewportClosure() {
*/
convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
return Util.applyInverseTransform([x, y], this.transform);
}
},
};
return PageViewport;
})();
@ -1154,7 +1154,7 @@ var StatTimer = (function StatTimerClosure() {
this.times.push({
'name': name,
'start': this.started[name],
'end': Date.now()
'end': Date.now(),
});
// Remove timer from started so it can be called again.
delete this.started[name];
@ -1177,14 +1177,14 @@ var StatTimer = (function StatTimerClosure() {
out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
}
return out;
}
},
};
return StatTimer;
})();
var createBlob = function createBlob(data, contentType) {
if (typeof Blob !== 'undefined') {
return new Blob([data], { type: contentType });
return new Blob([data], { type: contentType, });
}
throw new Error('The "Blob" constructor is not supported.');
};
@ -1254,7 +1254,7 @@ function MessageHandler(sourceName, targetName, comObj) {
targetName,
isReply: true,
callbackId: data.callbackId,
data: result
data: result,
});
}, function (reason) {
if (reason instanceof Error) {
@ -1266,7 +1266,7 @@ function MessageHandler(sourceName, targetName, comObj) {
targetName,
isReply: true,
callbackId: data.callbackId,
error: reason
error: reason,
});
});
} else {
@ -1344,7 +1344,7 @@ MessageHandler.prototype = {
destroy() {
this.comObj.removeEventListener('message', this._onComObjOnMessage);
}
},
};
function loadJpegStream(id, imageUrl, objs) {