mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 15:48:06 +02:00
Fix the linting errors, from the Prettier auto-formatting, that ESLint --fix
couldn't handle
This patch makes the follow changes: - Remove no longer necessary inline `// eslint-disable-...` comments. - Fix `// eslint-disable-...` comments that Prettier moved down, thus causing new linting errors. - Concatenate strings which now fit on just one line. - Fix comments that are now too long. - Finally, and most importantly, adjust comments that Prettier moved down, since the new positions often is confusing or outright wrong.
This commit is contained in:
parent
de36b2aaba
commit
a63f7ad486
46 changed files with 179 additions and 219 deletions
|
@ -9,7 +9,7 @@ const gitIgnore = "test/pdfs/.gitignore";
|
|||
if (process.argv.length < 3) {
|
||||
console.log("\nUsage: node add_test.js FILE\n");
|
||||
console.log(
|
||||
" Add a PDF as a reference test. FILE must be located in " + `${pdfFolder}`
|
||||
` Add a PDF as a reference test. FILE must be located in ${pdfFolder}`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
@ -277,8 +277,8 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
|
|||
/**
|
||||
* @class
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var Driver = (function DriverClosure() {
|
||||
// eslint-disable-line no-unused-vars
|
||||
/**
|
||||
* @constructs Driver
|
||||
* @param {DriverOptions} options
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
var base64alphabet =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function decodeFontData(base64) {
|
||||
// eslint-disable-line no-unused-vars
|
||||
var result = [];
|
||||
|
||||
var bits = 0,
|
||||
|
@ -68,8 +68,8 @@ function encodeFontData(data) {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function ttx(data, callback) {
|
||||
// eslint-disable-line no-unused-vars
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/ttx");
|
||||
|
||||
|
@ -89,8 +89,8 @@ function ttx(data, callback) {
|
|||
xhr.send(encodedData);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function verifyTtxOutput(output) {
|
||||
// eslint-disable-line no-unused-vars
|
||||
var m = /^<error>(.*?)<\/error>/.exec(output);
|
||||
if (m) {
|
||||
throw m[1];
|
||||
|
|
|
@ -889,8 +889,8 @@ function main() {
|
|||
} else if (!options.browser && !options.browserManifestFile) {
|
||||
startServer();
|
||||
} else if (options.unitTest) {
|
||||
// Allows linked PDF files in unit-tests as well.
|
||||
ensurePDFsDownloaded(function() {
|
||||
// Allows linked PDF files in unit-tests.
|
||||
startUnitTest("/test/unit/unit_test.html", "unit");
|
||||
});
|
||||
} else if (options.fontTest) {
|
||||
|
|
|
@ -124,8 +124,8 @@ describe("core_utils", function() {
|
|||
const dict = new Dict();
|
||||
let currentDict = dict;
|
||||
let parentDict = null;
|
||||
// Exceed the loop limit of 100.
|
||||
for (let i = 0; i < 150; i++) {
|
||||
// Exceeds the loop limit of 100.
|
||||
parentDict = new Dict();
|
||||
currentDict.set("Parent", parentDict);
|
||||
currentDict = parentDict;
|
||||
|
|
|
@ -89,7 +89,7 @@ describe("crypto", function() {
|
|||
it("should pass RFC 1321 test #6", function() {
|
||||
var input, result, expected;
|
||||
input = stringToBytes(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv" + "wxyz0123456789"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||
);
|
||||
result = calculateMD5(input, 0, input.length);
|
||||
expected = hex2binary("d174ab98d277d9f5a5611c2c9f419d9f");
|
||||
|
@ -209,12 +209,12 @@ describe("crypto", function() {
|
|||
var key, input, result, expected, cipher;
|
||||
key = hex2binary("0123456789abcdef");
|
||||
input = hex2binary(
|
||||
"123456789abcdef0123456789abcdef0123456789abcdef0123" + "45678"
|
||||
"123456789abcdef0123456789abcdef0123456789abcdef012345678"
|
||||
);
|
||||
cipher = new ARCFourCipher(key);
|
||||
result = cipher.encryptBlock(input);
|
||||
expected = hex2binary(
|
||||
"66a0949f8af7d6891f7f832ba833c00c892ebe30143ce287" + "40011ecf"
|
||||
"66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf"
|
||||
);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
|
@ -226,18 +226,18 @@ describe("crypto", function() {
|
|||
input = stringToBytes("abc");
|
||||
result = calculateSHA256(input, 0, input.length);
|
||||
expected = hex2binary(
|
||||
"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9C" + "B410FF61F20015AD"
|
||||
"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD"
|
||||
);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
it("should properly hash a multiblock input", function() {
|
||||
var input, result, expected;
|
||||
input = stringToBytes(
|
||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmno" + "mnopnopq"
|
||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
|
||||
);
|
||||
result = calculateSHA256(input, 0, input.length);
|
||||
expected = hex2binary(
|
||||
"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167" + "F6ECEDD419DB06C1"
|
||||
"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"
|
||||
);
|
||||
expect(result).toEqual(expected);
|
||||
});
|
||||
|
|
|
@ -40,7 +40,7 @@ describe("parser", function() {
|
|||
|
||||
it("should skip to the end of stream if the EI marker is not found", function() {
|
||||
const string =
|
||||
"q 1 0 0 1 0 0 cm BI /W 10 /H 10 /BPC 1 " + "/F /A85 ID abc123~> Q";
|
||||
"q 1 0 0 1 0 0 cm BI /W 10 /H 10 /BPC 1 /F /A85 ID abc123~> Q";
|
||||
const input = new StringStream(string);
|
||||
const parser = new Parser({
|
||||
lexer: new Lexer(input),
|
||||
|
@ -320,7 +320,7 @@ describe("parser", function() {
|
|||
return Linearization.create(stream2);
|
||||
}).toThrow(
|
||||
new Error(
|
||||
'The "E" parameter in the linearization ' + "dictionary is invalid."
|
||||
'The "E" parameter in the linearization dictionary is invalid.'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -343,7 +343,7 @@ describe("parser", function() {
|
|||
return Linearization.create(stream3);
|
||||
}).toThrow(
|
||||
new Error(
|
||||
'The "O" parameter in the linearization ' + "dictionary is invalid."
|
||||
'The "O" parameter in the linearization dictionary is invalid.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ describe("parser", function() {
|
|||
expect(function() {
|
||||
return Linearization.create(stream1);
|
||||
}).toThrow(
|
||||
new Error("Hint array in the linearization dictionary " + "is invalid.")
|
||||
new Error("Hint array in the linearization dictionary is invalid.")
|
||||
);
|
||||
|
||||
// The hint array should contain two, or four, elements.
|
||||
|
@ -389,7 +389,7 @@ describe("parser", function() {
|
|||
expect(function() {
|
||||
return Linearization.create(stream2);
|
||||
}).toThrow(
|
||||
new Error("Hint array in the linearization dictionary " + "is invalid.")
|
||||
new Error("Hint array in the linearization dictionary is invalid.")
|
||||
);
|
||||
|
||||
// The hint array should not contain zero.
|
||||
|
@ -410,7 +410,7 @@ describe("parser", function() {
|
|||
expect(function() {
|
||||
return Linearization.create(stream3);
|
||||
}).toThrow(
|
||||
new Error("Hint (2) in the linearization dictionary " + "is invalid.")
|
||||
new Error("Hint (2) in the linearization dictionary is invalid.")
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue