1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Fix inconsistent spacing and trailing commas in objects in src/core/ files, so we can enable the comma-dangle and object-curly-spacing ESLint rules later on

*Unfortunately this patch is fairly big, even though it only covers the `src/core` folder, but splitting it even further seemed difficult.*

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/core/evaluator.js b/src/core/evaluator.js
index abab9027..dcd3594b 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -2785,7 +2785,8 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
     t['Tz'] = { id: OPS.setHScale, numArgs: 1, variableArgs: false, };
     t['TL'] = { id: OPS.setLeading, numArgs: 1, variableArgs: false, };
     t['Tf'] = { id: OPS.setFont, numArgs: 2, variableArgs: false, };
-    t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false, };
+    t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1,
+                variableArgs: false, };
     t['Ts'] = { id: OPS.setTextRise, numArgs: 1, variableArgs: false, };
     t['Td'] = { id: OPS.moveText, numArgs: 2, variableArgs: false, };
     t['TD'] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false, };
diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 5a17d482..71671541 100644
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -123,19 +123,22 @@ var Jbig2Image = (function Jbig2ImageClosure() {
      { x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -2, y: 0, },
      { x: -1, y: 0, }],
     [{ x: -3, y: -1, }, { x: -2, y: -1, }, { x: -1, y: -1, }, { x: 0, y: -1, },
-     { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, { x: -1, y: 0, }]
+     { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, },
+     { x: -1, y: 0, }]
   ];

   var RefinementTemplates = [
     {
       coding: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
-      reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
-                  { x: 1, y: 0, }, { x: -1, y: 1, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
+      reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, },
+                  { x: 0, y: 0, }, { x: 1, y: 0, }, { x: -1, y: 1, },
+                  { x: 0, y: 1, }, { x: 1, y: 1, }],
     },
     {
-      coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
-      reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, { x: 1, y: 0, },
-                  { x: 0, y: 1, }, { x: 1, y: 1, }],
+      coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, },
+               { x: -1, y: 0, }],
+      reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
+                  { x: 1, y: 0, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
     }
   ];
```
This commit is contained in:
Jonas Jenwald 2017-06-02 11:16:24 +02:00
parent 593dec1bb7
commit a8c87f8019
29 changed files with 586 additions and 582 deletions

View file

@ -105,7 +105,7 @@ var Catalog = (function CatalogClosure() {
if (!isRef(obj)) {
return null;
}
var root = { items: [] };
var root = { items: [], };
var queue = [{ obj, parent: root, }];
// To avoid recursion, keep track of the already processed items.
var processed = new RefSet();
@ -145,7 +145,7 @@ var Catalog = (function CatalogClosure() {
count: outlineDict.get('Count'),
bold: !!(flags & 2),
italic: !!(flags & 1),
items: []
items: [],
};
i.parent.items.push(outlineItem);
obj = outlineDict.getRaw('First');
@ -556,7 +556,7 @@ var Catalog = (function CatalogClosure() {
}
return next(pageRef);
}
},
};
/**
@ -739,7 +739,7 @@ var XRef = (function XRefClosure() {
this.cache = [];
this.stats = {
streamTypes: [],
fontTypes: []
fontTypes: [],
};
}
@ -787,7 +787,7 @@ var XRef = (function XRefClosure() {
entryNum: 0,
streamPos: parser.lexer.stream.pos,
parserBuf1: parser.buf1,
parserBuf2: parser.buf2
parserBuf2: parser.buf2,
};
}
@ -919,7 +919,7 @@ var XRef = (function XRefClosure() {
entryRanges: range,
byteWidths,
entryNum: 0,
streamPos: stream.pos
streamPos: stream.pos,
};
}
this.readXRefStream(stream);
@ -1071,7 +1071,7 @@ var XRef = (function XRefClosure() {
this.entries[m[1]] = {
offset: position - stream.start,
gen: m[2] | 0,
uncompressed: true
uncompressed: true,
};
}
var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
@ -1369,7 +1369,7 @@ var XRef = (function XRefClosure() {
getCatalogObj: function XRef_getCatalogObj() {
return this.root;
}
},
};
return XRef;
@ -1490,7 +1490,7 @@ var NameOrNumberTree = (function NameOrNumberTreeClosure() {
}
}
return null;
}
},
};
return NameOrNumberTree;
})();
@ -1602,9 +1602,9 @@ var FileSpec = (function FileSpecClosure() {
get serializable() {
return {
filename: this.filename,
content: this.content
content: this.content,
};
}
},
};
return FileSpec;
})();
@ -1702,7 +1702,7 @@ var ObjectLoader = (function() {
throw e;
}
nodesToRevisit.push(currentNode);
pendingRequests.push({ begin: e.begin, end: e.end });
pendingRequests.push({ begin: e.begin, end: e.end, });
}
}
if (currentNode && currentNode.getBaseStreams) {
@ -1714,7 +1714,7 @@ var ObjectLoader = (function() {
foundMissingData = true;
pendingRequests.push({
begin: stream.start,
end: stream.end
end: stream.end,
});
}
}
@ -1744,7 +1744,7 @@ var ObjectLoader = (function() {
// Everything is loaded.
this.refSet = null;
this.capability.resolve();
}
},
};
return ObjectLoader;