Enable the ESLint `operator-assignment` rule

This patch was generated automatically, using the `gulp lint --fix` command.

Please find additional details about the ESLint rule at https://eslint.org/docs/rules/operator-assignment
This commit is contained in:
Jonas Jenwald 2021-07-04 11:51:11 +02:00
Родитель de80590157
Коммит 901b24e8af
13 изменённых файлов: 35 добавлений и 36 удалений

Просмотреть файл

@ -188,6 +188,7 @@
},
],
"no-unneeded-ternary": "error",
"operator-assignment": "error",
"prefer-exponentiation-operator": "error",
"spaced-comment": ["error", "always", {
"block": {

2
external/cmapscompress/compress.js поставляемый
Просмотреть файл

@ -409,7 +409,7 @@ function writeSigned(n) {
const d = fromHexDigit(n[i]);
c = (c << 4) | (neg ? d ^ 15 : d);
t += toHexDigit(c >> 3);
c = c & 7;
c &= 7;
}
t += toHexDigit((c << 1) | (neg ? 1 : 0));
return writeNumber(t);

Просмотреть файл

@ -936,7 +936,7 @@ const CFFParser = (function CFFParserClosure() {
}
raw = bytes.subarray(dataStart, dataEnd);
}
format = format & 0x7f;
format &= 0x7f;
return new CFFEncoding(predefined, format, encoding, raw);
}
@ -1552,7 +1552,7 @@ class CFFCompiler {
if (value >= -107 && value <= 107) {
code = [value + 139];
} else if (value >= 108 && value <= 1131) {
value = value - 108;
value -= 108;
code = [(value >> 8) + 247, value & 0xff];
} else if (value >= -1131 && value <= -108) {
value = -value - 108;

Просмотреть файл

@ -213,7 +213,7 @@ class Word64 {
this.low = 0;
} else {
this.high = (this.high << places) | (this.low >>> (32 - places));
this.low = this.low << places;
this.low <<= places;
}
}
@ -1165,7 +1165,7 @@ class AES128Cipher extends AESBaseCipher {
t3 = s[t3];
t4 = s[t4];
// Rcon
t1 = t1 ^ rcon[i];
t1 ^= rcon[i];
for (let n = 0; n < 4; ++n) {
result[j] = t1 ^= result[j - 16];
j++;
@ -1218,7 +1218,7 @@ class AES256Cipher extends AESBaseCipher {
t3 = s[t3];
t4 = s[t4];
// Rcon
t1 = t1 ^ r;
t1 ^= r;
if ((r <<= 1) >= 256) {
r = (r ^ 0x1b) & 0xff;
}

Просмотреть файл

@ -216,7 +216,7 @@ class Page {
if (rotate % 90 !== 0) {
rotate = 0;
} else if (rotate >= 360) {
rotate = rotate % 360;
rotate %= 360;
} else if (rotate < 0) {
// The spec doesn't cover negatives. Assume it's counterclockwise
// rotation. The following is the other implementation of modulo.

Просмотреть файл

@ -286,7 +286,7 @@ class SimpleGlyph {
flags.push(flag);
if (flag & REPEAT_FLAG) {
const count = glyf.getUint8(++pos);
flag = flag ^ REPEAT_FLAG;
flag ^= REPEAT_FLAG;
for (let m = 0; m < count; m++) {
flags.push(flag);
}
@ -412,16 +412,15 @@ class SimpleGlyph {
const x = contour.xCoordinates[i];
let delta = x - lastX;
if (delta === 0) {
flag = flag | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
xCoordinates.push(0);
} else {
const abs = Math.abs(delta);
if (abs <= 255) {
flag =
flag |
(delta >= 0
flag |=
delta >= 0
? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR
: X_SHORT_VECTOR);
: X_SHORT_VECTOR;
xCoordinates.push(abs);
} else {
xCoordinates.push(delta);
@ -432,16 +431,15 @@ class SimpleGlyph {
const y = contour.yCoordinates[i];
delta = y - lastY;
if (delta === 0) {
flag = flag | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
yCoordinates.push(0);
} else {
const abs = Math.abs(delta);
if (abs <= 255) {
flag =
flag |
(delta >= 0
flag |=
delta >= 0
? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR
: Y_SHORT_VECTOR);
: Y_SHORT_VECTOR;
yCoordinates.push(abs);
} else {
yCoordinates.push(delta);
@ -550,7 +548,7 @@ class CompositeGlyph {
argument2 = glyf.getUint16(pos + 2);
}
pos += 4;
flags = flags ^ ARG_1_AND_2_ARE_WORDS;
flags ^= ARG_1_AND_2_ARE_WORDS;
} else {
argument1 = glyf.getUint8(pos);
argument2 = glyf.getUint8(pos + 1);
@ -652,7 +650,7 @@ class CompositeGlyph {
this.argument2 <= 127
)
) {
this.flags = this.flags | ARG_1_AND_2_ARE_WORDS;
this.flags |= ARG_1_AND_2_ARE_WORDS;
}
} else {
if (
@ -663,7 +661,7 @@ class CompositeGlyph {
this.argument2 <= 255
)
) {
this.flags = this.flags | ARG_1_AND_2_ARE_WORDS;
this.flags |= ARG_1_AND_2_ARE_WORDS;
}
}

Просмотреть файл

@ -471,7 +471,7 @@ class PDFImage {
value = max;
}
output[i] = value;
buf = buf & ((1 << remainingBits) - 1);
buf &= (1 << remainingBits) - 1;
bits = remainingBits;
}
}

Просмотреть файл

@ -2241,7 +2241,7 @@ class Transform {
class IrreversibleTransform extends Transform {
filter(x, offset, length) {
const len = length >> 1;
offset = offset | 0;
offset |= 0;
let j, n, current, next;
const alpha = -1.586134342059924;
@ -2327,7 +2327,7 @@ class IrreversibleTransform extends Transform {
class ReversibleTransform extends Transform {
filter(x, offset, length) {
const len = length >> 1;
offset = offset | 0;
offset |= 0;
let j, n;
for (j = offset, n = len + 1; n--; j += 2) {

Просмотреть файл

@ -312,7 +312,7 @@ const Type1CharString = (function Type1CharStringClosure() {
}
continue;
} else if (value <= 246) {
value = value - 139;
value -= 139;
} else if (value <= 250) {
value = (value - 247) * 256 + encoded[++i] + 108;
} else if (value <= 254) {

Просмотреть файл

@ -202,8 +202,8 @@ class AnnotationElement {
// Underline styles only have a bottom border, so we do not need
// to adjust for all borders. This yields a similar result as
// Adobe Acrobat/Reader.
width = width - 2 * data.borderStyle.width;
height = height - 2 * data.borderStyle.width;
width -= 2 * data.borderStyle.width;
height -= 2 * data.borderStyle.width;
}
const horizontalRadius = data.borderStyle.horizontalCornerRadius;

Просмотреть файл

@ -145,10 +145,10 @@ function addContextCurrentTransform(ctx) {
ctx.scale = function ctxScale(x, y) {
const m = this._transformMatrix;
m[0] = m[0] * x;
m[1] = m[1] * x;
m[2] = m[2] * y;
m[3] = m[3] * y;
m[0] *= x;
m[1] *= x;
m[2] *= y;
m[3] *= y;
this._originalScale(x, y);
};

Просмотреть файл

@ -54,10 +54,10 @@ describe("find bar", () => {
const firstA = await highlights[0].boundingBox();
const secondA = await highlights[1].boundingBox();
// Subtract the page offset from the text bounding boxes;
firstA.x = firstA.x - pageBox.x;
firstA.y = firstA.y - pageBox.y;
secondA.x = secondA.x - pageBox.x;
secondA.y = secondA.y - pageBox.y;
firstA.x -= pageBox.x;
firstA.y -= pageBox.y;
secondA.x -= pageBox.x;
secondA.y -= pageBox.y;
// They should be on the same line.
expect(firstA.y).withContext(`In ${browserName}`).toEqual(secondA.y);
const fontSize = 26.66; // From the PDF.

Просмотреть файл

@ -220,7 +220,7 @@ var StepperManager = (function StepperManagerClosure() {
},
selectStepper: function selectStepper(pageIndex, selectPanel) {
let i;
pageIndex = pageIndex | 0;
pageIndex |= 0;
if (selectPanel) {
this.manager.selectPanel(this);
}