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-const rule globally (PR 11450 follow-up)

Please find additional details about the ESLint rule at https://eslint.org/docs/rules/prefer-const

With the recent introduction of Prettier this sort of mass enabling of ESLint rules becomes a lot easier, since the code will be automatically reformatted as necessary to account for e.g. changed line lengths.

Note that this patch is generated automatically, by using the ESLint `--fix` argument, and will thus require some additional clean-up (which is done separately).
This commit is contained in:
Jonas Jenwald 2020-01-24 09:48:21 +01:00
parent d2d9441373
commit 9e262ae7fa
54 changed files with 676 additions and 661 deletions

View file

@ -21,7 +21,7 @@ import { shadow } from "../shared/util.js";
* For JPEG 2000's we use a library to decode these images and
* the stream behaves like all the other DecodeStreams.
*/
let JpxStream = (function JpxStreamClosure() {
const JpxStream = (function JpxStreamClosure() {
function JpxStream(stream, maybeLength, dict, params) {
this.stream = stream;
this.maybeLength = maybeLength;
@ -50,33 +50,33 @@ let JpxStream = (function JpxStreamClosure() {
if (this.eof) {
return;
}
let jpxImage = new JpxImage();
const jpxImage = new JpxImage();
jpxImage.parse(this.bytes);
let width = jpxImage.width;
let height = jpxImage.height;
let componentsCount = jpxImage.componentsCount;
let tileCount = jpxImage.tiles.length;
const width = jpxImage.width;
const height = jpxImage.height;
const componentsCount = jpxImage.componentsCount;
const tileCount = jpxImage.tiles.length;
if (tileCount === 1) {
this.buffer = jpxImage.tiles[0].items;
} else {
let data = new Uint8ClampedArray(width * height * componentsCount);
const data = new Uint8ClampedArray(width * height * componentsCount);
for (let k = 0; k < tileCount; k++) {
let tileComponents = jpxImage.tiles[k];
let tileWidth = tileComponents.width;
let tileHeight = tileComponents.height;
let tileLeft = tileComponents.left;
let tileTop = tileComponents.top;
const tileComponents = jpxImage.tiles[k];
const tileWidth = tileComponents.width;
const tileHeight = tileComponents.height;
const tileLeft = tileComponents.left;
const tileTop = tileComponents.top;
let src = tileComponents.items;
const src = tileComponents.items;
let srcPosition = 0;
let dataPosition = (width * tileTop + tileLeft) * componentsCount;
let imgRowSize = width * componentsCount;
let tileRowSize = tileWidth * componentsCount;
const imgRowSize = width * componentsCount;
const tileRowSize = tileWidth * componentsCount;
for (let j = 0; j < tileHeight; j++) {
let rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
data.set(rowBytes, dataPosition);
srcPosition += tileRowSize;
dataPosition += imgRowSize;