1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Enable the ESLint prefer-spread rule

Note that in a couple of spots the argument could be `undefined` and there we simply disable the rule instead.

Please refer to https://eslint.org/docs/latest/rules/prefer-spread
This commit is contained in:
Jonas Jenwald 2022-08-06 10:16:09 +02:00
parent d6d4653d80
commit f6db7975c5
9 changed files with 37 additions and 34 deletions

View file

@ -3717,7 +3717,7 @@ class PartialEvaluator {
const w2 = (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1);
str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
}
map[charCode] = String.fromCodePoint.apply(String, str);
map[charCode] = String.fromCodePoint(...str);
});
return new ToUnicodeMap(map);
},

View file

@ -1478,6 +1478,7 @@ function processSegment(segment, visitor) {
}
const callbackName = "on" + header.typeName;
if (callbackName in visitor) {
// eslint-disable-next-line prefer-spread
visitor[callbackName].apply(visitor, args);
}
}
@ -1636,7 +1637,7 @@ class SimpleSegmentVisitor {
}
onImmediateLosslessGenericRegion() {
this.onImmediateGenericRegion.apply(this, arguments);
this.onImmediateGenericRegion(...arguments);
}
onSymbolDictionary(
@ -1743,7 +1744,7 @@ class SimpleSegmentVisitor {
}
onImmediateLosslessTextRegion() {
this.onImmediateTextRegion.apply(this, arguments);
this.onImmediateTextRegion(...arguments);
}
onPatternDictionary(dictionary, currentSegment, data, start, end) {
@ -1788,7 +1789,7 @@ class SimpleSegmentVisitor {
}
onImmediateLosslessHalftoneRegion() {
this.onImmediateHalftoneRegion.apply(this, arguments);
this.onImmediateHalftoneRegion(...arguments);
}
onTables(currentSegment, data, start, end) {

View file

@ -351,7 +351,7 @@ const Type1CharString = (function Type1CharStringClosure() {
);
}
}
this.output.push.apply(this.output, command);
this.output.push(...command);
if (keepStack) {
this.stack.splice(start, howManyArgs);
} else {