mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Enable the dot-notation
ESLint rule
*Please note:* These changes were done automatically, using the `gulp lint --fix` command. This rule is already enabled in mozilla-central, see https://searchfox.org/mozilla-central/rev/567b68b8ff4b6d607ba34a6f1926873d21a7b4d7/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js#103-104 The main advantage, besides improved consistency, of this rule is that it reduces the size of the code (by 3 bytes for each case). In the PDF.js code-base there's close to 8000 instances being fixed by the `dot-notation` ESLint rule, which end up reducing the size of even the *built* files significantly; the total size of the `gulp mozcentral` build target changes from `3 247 456` to `3 224 278` bytes, which is a *reduction* of `23 178` bytes (or ~0.7%) for a completely mechanical change. A large number of these changes affect the (large) lookup tables used on the worker-thread, but given that they are still initialized lazily I don't *think* that the new formatting this patch introduces should undo any of the improvements from PR 6915. Please find additional details about the ESLint rule at https://eslint.org/docs/rules/dot-notation
This commit is contained in:
parent
c218e94f66
commit
1cc3dbb694
26 changed files with 7773 additions and 7785 deletions
20
gulpfile.js
20
gulpfile.js
|
@ -171,7 +171,7 @@ function createWebpackConfig(defines, output) {
|
|||
var bundleDefines = builder.merge(defines, {
|
||||
BUNDLE_VERSION: versionInfo.version,
|
||||
BUNDLE_BUILD: versionInfo.commit,
|
||||
TESTING: defines.TESTING || process.env["TESTING"] === "true",
|
||||
TESTING: defines.TESTING || process.env.TESTING === "true",
|
||||
});
|
||||
var licenseHeaderLibre = fs
|
||||
.readFileSync("./src/license_header_libre.js")
|
||||
|
@ -414,9 +414,9 @@ function createTestSource(testsName, bot) {
|
|||
console.log();
|
||||
console.log("### Running " + testsName + " tests");
|
||||
|
||||
var PDF_TEST = process.env["PDF_TEST"] || "test_manifest.json";
|
||||
var PDF_TEST = process.env.PDF_TEST || "test_manifest.json";
|
||||
var PDF_BROWSERS =
|
||||
process.env["PDF_BROWSERS"] ||
|
||||
process.env.PDF_BROWSERS ||
|
||||
"resources/browser_manifests/browser_manifest.json";
|
||||
|
||||
if (!checkFile("test/" + PDF_BROWSERS)) {
|
||||
|
@ -467,7 +467,7 @@ function makeRef(done, bot) {
|
|||
console.log("### Creating reference images");
|
||||
|
||||
var PDF_BROWSERS =
|
||||
process.env["PDF_BROWSERS"] ||
|
||||
process.env.PDF_BROWSERS ||
|
||||
"resources/browser_manifests/browser_manifest.json";
|
||||
|
||||
if (!checkFile("test/" + PDF_BROWSERS)) {
|
||||
|
@ -1201,7 +1201,7 @@ function buildLib(defines, dir) {
|
|||
var bundleDefines = builder.merge(defines, {
|
||||
BUNDLE_VERSION: versionInfo.version,
|
||||
BUNDLE_BUILD: versionInfo.commit,
|
||||
TESTING: process.env["TESTING"] === "true",
|
||||
TESTING: process.env.TESTING === "true",
|
||||
});
|
||||
var ctx = {
|
||||
rootPath: __dirname,
|
||||
|
@ -1287,7 +1287,7 @@ gulp.task(
|
|||
);
|
||||
|
||||
gulp.task("testing-pre", function (done) {
|
||||
process.env["TESTING"] = "true";
|
||||
process.env.TESTING = "true";
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ gulp.task("baseline", function (done) {
|
|||
console.log();
|
||||
console.log("### Creating baseline environment");
|
||||
|
||||
var baselineCommit = process.env["BASELINE"];
|
||||
var baselineCommit = process.env.BASELINE;
|
||||
if (!baselineCommit) {
|
||||
done(new Error("Missing baseline commit. Specify the BASELINE variable."));
|
||||
return;
|
||||
|
@ -1552,7 +1552,7 @@ gulp.task("wintersmith", function (done) {
|
|||
|
||||
gulp.task("gh-pages-git", function (done) {
|
||||
var VERSION = getVersionJSON().version;
|
||||
var reason = process.env["PDFJS_UPDATE_REASON"];
|
||||
var reason = process.env.PDFJS_UPDATE_REASON;
|
||||
|
||||
safeSpawnSync("git", ["init"], { cwd: GH_PAGES_DIR });
|
||||
safeSpawnSync("git", ["remote", "add", "origin", REPO], {
|
||||
|
@ -1720,7 +1720,7 @@ gulp.task(
|
|||
gulp.series("dist-pre", function (done) {
|
||||
var distPath = DIST_DIR;
|
||||
var opts = {};
|
||||
var installPath = process.env["PDFJS_INSTALL_PATH"];
|
||||
var installPath = process.env.PDFJS_INSTALL_PATH;
|
||||
if (installPath) {
|
||||
opts.cwd = installPath;
|
||||
distPath = path.relative(installPath, distPath);
|
||||
|
@ -1738,7 +1738,7 @@ gulp.task(
|
|||
console.log();
|
||||
console.log("### Committing changes");
|
||||
|
||||
var reason = process.env["PDFJS_UPDATE_REASON"];
|
||||
var reason = process.env.PDFJS_UPDATE_REASON;
|
||||
// Attempt to work-around the broken link, see https://github.com/mozilla/pdf.js/issues/10391
|
||||
if (typeof reason === "string") {
|
||||
var reasonParts = /^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue