1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08: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

@ -222,6 +222,7 @@ function recoverGlyphName(name, glyphsUnicodeMap) {
}
var Glyph = (function GlyphClosure() {
// eslint-disable-next-line no-shadow
function Glyph(
fontChar,
unicode,
@ -268,6 +269,7 @@ var Glyph = (function GlyphClosure() {
})();
var ToUnicodeMap = (function ToUnicodeMapClosure() {
// eslint-disable-next-line no-shadow
function ToUnicodeMap(cmap = []) {
// The elements of this._map can be integers or strings, depending on how
// `cmap` was created.
@ -319,6 +321,7 @@ var ToUnicodeMap = (function ToUnicodeMapClosure() {
})();
var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {
// eslint-disable-next-line no-shadow
function IdentityToUnicodeMap(firstChar, lastChar) {
this.firstChar = firstChar;
this.lastChar = lastChar;
@ -389,6 +392,7 @@ var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
}
}
// eslint-disable-next-line no-shadow
function OpenTypeFileBuilder(sfnt) {
this.sfnt = sfnt;
this.tables = Object.create(null);
@ -512,6 +516,7 @@ var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {
* type1Font.bind();
*/
var Font = (function FontClosure() {
// eslint-disable-next-line no-shadow
function Font(name, file, properties) {
var charCode;
@ -3305,6 +3310,7 @@ var Font = (function FontClosure() {
})();
var ErrorFont = (function ErrorFontClosure() {
// eslint-disable-next-line no-shadow
function ErrorFont(error) {
this.error = error;
this.loadedName = "g_font_error";
@ -3518,6 +3524,7 @@ var Type1Font = (function Type1FontClosure() {
};
}
// eslint-disable-next-line no-shadow
function Type1Font(name, file, properties) {
// Some bad generators embed pfb file as is, we have to strip 6-byte header.
// Also, length1 and length2 might be off by 6 bytes as well.
@ -3784,6 +3791,7 @@ var Type1Font = (function Type1FontClosure() {
})();
var CFFFont = (function CFFFontClosure() {
// eslint-disable-next-line no-shadow
function CFFFont(file, properties) {
this.properties = properties;