Skip to content

fix: closures in for-loop test and update capture wrong binding - #18441

Merged
nicolo-ribaudo merged 3 commits into
7.xfrom
automation/backport-18371
Oct 29, 2026
Merged

nicolo-ribaudo merged 3 commits into
7.xfrom
automation/backport-18371

Conversation

@babel-bot

Copy link
Copy Markdown
Collaborator

Backport of #18371 to 7.x

Cherry-picked commits:

Conflicts: Resolved.

  • packages/babel-plugin-transform-block-scoping/src/index.ts: main had the Babel 8 isVarInForStatementInit import and a differently structured/indented visitor (merged with annexB33FunctionsVisitor). I kept the 7.x file and only added the moveCapturingTestAndUpdateIntoBody import and call.

Fix commit: "Fix lint and fixture output after backporting #18371"

  • src/loop.ts: removed non-null assertions flagged by eslint (no-unnecessary-type-assertion) since 7.x types differ.
  • test/fixtures/general/for-test-closure-function-in-body/output.js: regenerated, as 7.x Annex B handling emits var _g = function () {}; g = _g;.

Checks:

  • rebuild: passed.
  • block-scoping tests: passed.
  • lint: eslint on block-scoping passes, and tscheck ran. The full make lint-ci check-compat-data failed only because check-compat-data cannot clone compat-table (no network/cert error).
  • test (full): 6 failures in babel-code-frame color-detection tests, unrelated to this PR (environment related). All else passed.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 🔙 Backport to 7.x for #18371 · copilot · auto · 40.3 AIC · ⌖ 0.786 AIC · ⊞ 9.1K · ◷

joellemd and others added 2 commits October 29, 2026 12:08
Remove non-null assertions unnecessary with 7.x types and regenerate the Annex B fixture output, which differs on 7.x.
@babel-bot babel-bot added 7.x: backport PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Oct 29, 2026
@babel-bot

babel-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/62671

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: 0b05587

@JLHwung

JLHwung commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@copilot Add minNodeVersion: 8 to the options.json of the failing for-test-closure-await-in-test test.

Copilot AI commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

@copilot Add minNodeVersion: 8 to the options.json of the failing for-test-closure-await-in-test test.

Added minNodeVersion: 8 in commit 0c050cb8.

Copilot AI requested a review from JLHwung October 29, 2026 13:09
@JLHwung
JLHwung force-pushed the automation/backport-18371 branch from 0c050cb to 0b05587 Compare October 29, 2026 13:15
@nicolo-ribaudo
nicolo-ribaudo merged commit 8460b8a into 7.x Oct 29, 2026
169 of 170 checks passed
@nicolo-ribaudo
nicolo-ribaudo deleted the automation/backport-18371 branch October 29, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.x: backport PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants