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

Enable ESLint rules that no longer need to be disabled on a directory/file-basis

Given that browsers/environments without native support for both arrow functions and object shorthand properties are no longer supported in PDF.js, please refer to the compatibility information below, we can now enable a fair number of ESLint rules and also simplify/remove some `.eslintrc` files.

With the exception of the `no-alert` cases, all code changes were made automatically by using `gulp lint --fix`.

 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#browser_compatibility
This commit is contained in:
Jonas Jenwald 2021-01-22 17:38:26 +01:00
parent 2cba290361
commit 4db7330677
25 changed files with 76 additions and 110 deletions

View file

@ -35,7 +35,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
throw new Error("No code for testing is given");
}
var isTrue = !!evalWithDefines(arg.value, ctx.defines);
return { type: "Literal", value: isTrue, loc: loc };
return { type: "Literal", value: isTrue, loc };
case "eval":
arg = args[0];
if (!arg || arg.type !== "Literal" || typeof arg.value !== "string") {
@ -47,7 +47,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
typeof result === "string" ||
typeof result === "number"
) {
return { type: "Literal", value: result, loc: loc };
return { type: "Literal", value: result, loc };
}
if (typeof result === "object") {
const parsedObj = acorn.parse("(" + JSON.stringify(result) + ")", {
@ -333,8 +333,8 @@ function preprocessPDFJSCode(ctx, code) {
sourceType: "module",
};
var codegenOptions = {
format: format,
parse: function (input) {
format,
parse(input) {
return acorn.parse(input, { ecmaVersion: ACORN_ECMA_VERSION });
},
sourceMap: ctx.sourceMap,