Skip to content

Remove unused variables with the Babel plugin#21339

Merged
Snuffleupagus merged 1 commit into
mozilla:masterfrom
nicolo-ribaudo:remove-unused-variables
May 26, 2026
Merged

Remove unused variables with the Babel plugin#21339
Snuffleupagus merged 1 commit into
mozilla:masterfrom
nicolo-ribaudo:remove-unused-variables

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Collaborator

  • functions were already removed
  • variables can be removed when their initializer does not have side effects
  • classes can be removed when they have no static blocks

Fixes #21337

@nicolo-ribaudo
Copy link
Copy Markdown
Collaborator Author

Oh well, GitHub actions is down.

Comment thread external/builder/fixtures_babel/deadcode.js Dismissed
Comment thread external/builder/fixtures_babel/deadcode.js Dismissed
Comment thread external/builder/fixtures_babel/deadcode.js Dismissed
Comment thread external/builder/fixtures_babel/deadcode.js Dismissed
Comment thread external/builder/fixtures_babel/deadcode.js Dismissed
Comment thread external/builder/babel-plugin-pdfjs-preprocessor.mjs Fixed
Comment thread external/builder/fixtures_babel/unused-variable-expected.js Dismissed
Comment thread external/builder/fixtures_babel/unused-variable.js Dismissed
Comment thread external/builder/fixtures_babel/unused-variable.js Dismissed
Comment thread external/builder/fixtures_babel/unused-variable.js Dismissed
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.42%. Comparing base (03eda70) to head (2691868).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21339      +/-   ##
==========================================
- Coverage   81.42%   81.42%   -0.01%     
==========================================
  Files         257      257              
  Lines       65351    65351              
==========================================
- Hits        53210    53209       -1     
- Misses      12141    12142       +1     
Flag Coverage Δ
integrationtest 67.00% <ø> (ø)
unittest 56.87% <ø> (-0.01%) ⬇️
unittestcli 56.07% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- functions were already removed
- variables can be removed when their initializer does not have side effects
- classes can be removed when they have no static blocks

Fixes mozilla#21337
@Snuffleupagus
Copy link
Copy Markdown
Collaborator

/botio browsertest

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/8358dc000813fef/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/6297e9a7697e0d8/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/8358dc000813fef/output.txt

Total script time: 18.24 mins

  • Regression tests: Passed

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/6297e9a7697e0d8/output.txt

Total script time: 25.50 mins

  • Regression tests: Passed

Copy link
Copy Markdown
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, thanks.

@Snuffleupagus Snuffleupagus merged commit 6a1368a into mozilla:master May 26, 2026
17 of 18 checks passed
@Snuffleupagus
Copy link
Copy Markdown
Collaborator

Despite all tests passing, it seems that this broke the GENERIC viewer since opening https://mozilla.github.io/pdf.js/web/viewer.html now fails:

Uncaught (in promise) ReferenceError: eventBus is not defined
    bindEvents app.js:2112
    initialize app.js:269
    run app.js:807
    webViewerLoad viewer.js:374
    <anonymous> viewer.js:385
app.js:2112:5

@nicolo-ribaudo Should we revert this for now, to not block other work, or could this be fixed quickly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the Babel plugin to remove unused top-level constants

5 participants