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

@ -21,6 +21,7 @@ var EOF = {};
var Name = (function NameClosure() {
let nameCache = Object.create(null);
// eslint-disable-next-line no-shadow
function Name(name) {
this.name = name;
}
@ -43,6 +44,7 @@ var Name = (function NameClosure() {
var Cmd = (function CmdClosure() {
let cmdCache = Object.create(null);
// eslint-disable-next-line no-shadow
function Cmd(cmd) {
this.cmd = cmd;
}
@ -68,6 +70,7 @@ var Dict = (function DictClosure() {
};
// xref is optional
// eslint-disable-next-line no-shadow
function Dict(xref) {
// Map should only be used internally, use functions below to access.
this._map = Object.create(null);
@ -185,6 +188,7 @@ var Dict = (function DictClosure() {
var Ref = (function RefClosure() {
let refCache = Object.create(null);
// eslint-disable-next-line no-shadow
function Ref(num, gen) {
this.num = num;
this.gen = gen;
@ -218,6 +222,7 @@ var Ref = (function RefClosure() {
// The reference is identified by number and generation.
// This structure stores only one instance of the reference.
var RefSet = (function RefSetClosure() {
// eslint-disable-next-line no-shadow
function RefSet() {
this.dict = Object.create(null);
}
@ -240,6 +245,7 @@ var RefSet = (function RefSetClosure() {
})();
var RefSetCache = (function RefSetCacheClosure() {
// eslint-disable-next-line no-shadow
function RefSetCache() {
this.dict = Object.create(null);
}