-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the dot-notation
ESLint rule
#11818
Enable the dot-notation
ESLint rule
#11818
Conversation
*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
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/dd541d2d255884d/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/b50b52f3a292da2/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/dd541d2d255884d/output.txt Total script time: 19.67 mins
Image differences available at: http://54.67.70.0:8877/dd541d2d255884d/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/b50b52f3a292da2/output.txt Total script time: 25.17 mins
Image differences available at: http://54.215.176.217:8877/b50b52f3a292da2/reftest-analyzer.html#web=eq.log |
/botio-windows test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/25cb7a31aca97c9/output.txt |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/25cb7a31aca97c9/output.txt Total script time: 60.00 mins |
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/c1706e82f1f636d/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/c1706e82f1f636d/output.txt Total script time: 2.54 mins Published |
I think this is also nicer visually, but the consistency is primarily nice. Thank you! |
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 thegulp mozcentral
build target changes from3 247 456
to3 224 278
bytes, which is a reduction of23 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