1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Enable the unicorn/no-array-push-push ESLint plugin rule

There's generally speaking no need to use multiple consecutive `Array.prototype.push()` calls, since that method accepts multiple arguments, and this ESLint rule helps enforce that pattern.

Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-push-push.md for additional information.
This commit is contained in:
Jonas Jenwald 2021-05-24 13:20:19 +02:00
parent 3538ef017f
commit ec3bcadf56
9 changed files with 80 additions and 84 deletions

View file

@ -234,11 +234,13 @@ function compileGlyf(code, cmds, font) {
}
const subglyph = font.glyphs[glyphIndex];
if (subglyph) {
cmds.push({ cmd: "save" });
cmds.push({
cmd: "transform",
args: [scaleX, scale01, scale10, scaleY, x, y],
});
cmds.push(
{ cmd: "save" },
{
cmd: "transform",
args: [scaleX, scale01, scale10, scaleY, x, y],
}
);
compileGlyf(subglyph, cmds, font);
cmds.push({ cmd: "restore" });
}
@ -524,8 +526,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
const bchar = stack.pop();
y = stack.pop();
x = stack.pop();
cmds.push({ cmd: "save" });
cmds.push({ cmd: "translate", args: [x, y] });
cmds.push({ cmd: "save" }, { cmd: "translate", args: [x, y] });
let cmap = lookupCmap(
font.cmap,
String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]])
@ -774,11 +775,11 @@ class CompiledFont {
}
}
const cmds = [];
cmds.push({ cmd: "save" });
cmds.push({ cmd: "transform", args: fontMatrix.slice() });
cmds.push({ cmd: "scale", args: ["size", "-size"] });
const cmds = [
{ cmd: "save" },
{ cmd: "transform", args: fontMatrix.slice() },
{ cmd: "scale", args: ["size", "-size"] },
];
this.compileGlyphImpl(code, cmds, glyphId);
cmds.push({ cmd: "restore" });