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

Whitelist closure related cases to address the remaining no-shadow linting errors

Given the way that "classes" were previously implemented in PDF.js, using regular functions and closures, there's a fair number of false positives when the `no-shadow` ESLint rule was enabled.

Note that while *some* of these `eslint-disable` statements can be removed if/when the relevant code is converted to proper `class`es, we'll probably never be able to get rid of all of them given our naming/coding conventions (however I don't really see this being a problem).
This commit is contained in:
Jonas Jenwald 2020-03-25 10:15:50 +01:00
parent 1d2f787d6a
commit dcb16af968
32 changed files with 109 additions and 0 deletions

View file

@ -24,6 +24,7 @@ import { isDict } from "./primitives.js";
import { isWhiteSpace } from "./core_utils.js";
var Stream = (function StreamClosure() {
// eslint-disable-next-line no-shadow
function Stream(arrayBuffer, start, length, dict) {
this.bytes =
arrayBuffer instanceof Uint8Array
@ -129,6 +130,7 @@ var Stream = (function StreamClosure() {
})();
var StringStream = (function StringStreamClosure() {
// eslint-disable-next-line no-shadow
function StringStream(str) {
const bytes = stringToBytes(str);
Stream.call(this, bytes);
@ -147,6 +149,7 @@ var DecodeStream = (function DecodeStreamClosure() {
// buffer.
var emptyBuffer = new Uint8Array(0);
// eslint-disable-next-line no-shadow
function DecodeStream(maybeMinBufferLength) {
this._rawMinBufferLength = maybeMinBufferLength || 0;
@ -282,6 +285,7 @@ var DecodeStream = (function DecodeStreamClosure() {
})();
var StreamsSequenceStream = (function StreamsSequenceStreamClosure() {
// eslint-disable-next-line no-shadow
function StreamsSequenceStream(streams) {
this.streams = streams;
@ -426,6 +430,7 @@ var FlateStream = (function FlateStreamClosure() {
0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000
]), 5];
// eslint-disable-next-line no-shadow
function FlateStream(str, maybeLength) {
this.str = str;
this.dict = str.dict;
@ -711,6 +716,7 @@ var FlateStream = (function FlateStreamClosure() {
})();
var PredictorStream = (function PredictorStreamClosure() {
// eslint-disable-next-line no-shadow
function PredictorStream(str, maybeLength, params) {
if (!isDict(params)) {
return str; // no prediction
@ -932,6 +938,7 @@ var PredictorStream = (function PredictorStreamClosure() {
})();
var DecryptStream = (function DecryptStreamClosure() {
// eslint-disable-next-line no-shadow
function DecryptStream(str, maybeLength, decrypt) {
this.str = str;
this.dict = str.dict;
@ -978,6 +985,7 @@ var DecryptStream = (function DecryptStreamClosure() {
})();
var Ascii85Stream = (function Ascii85StreamClosure() {
// eslint-disable-next-line no-shadow
function Ascii85Stream(str, maybeLength) {
this.str = str;
this.dict = str.dict;
@ -1062,6 +1070,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
})();
var AsciiHexStream = (function AsciiHexStreamClosure() {
// eslint-disable-next-line no-shadow
function AsciiHexStream(str, maybeLength) {
this.str = str;
this.dict = str.dict;
@ -1128,6 +1137,7 @@ var AsciiHexStream = (function AsciiHexStreamClosure() {
})();
var RunLengthStream = (function RunLengthStreamClosure() {
// eslint-disable-next-line no-shadow
function RunLengthStream(str, maybeLength) {
this.str = str;
this.dict = str.dict;
@ -1175,6 +1185,7 @@ var RunLengthStream = (function RunLengthStreamClosure() {
})();
var LZWStream = (function LZWStreamClosure() {
// eslint-disable-next-line no-shadow
function LZWStream(str, maybeLength, earlyChange) {
this.str = str;
this.dict = str.dict;
@ -1311,6 +1322,7 @@ var LZWStream = (function LZWStreamClosure() {
})();
var NullStream = (function NullStreamClosure() {
// eslint-disable-next-line no-shadow
function NullStream() {
Stream.call(this, new Uint8Array(0));
}