Skip to content

Deprecate spec and loose plugin options#17972

Merged
nicolo-ribaudo merged 8 commits into
babel:mainfrom
liuxingbaoyu:deprecate-loose-spec
May 12, 2026
Merged

Deprecate spec and loose plugin options#17972
nicolo-ribaudo merged 8 commits into
babel:mainfrom
liuxingbaoyu:deprecate-loose-spec

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu commented May 2, 2026

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link babel/website#3201
Any Dependency Changes?
License MIT

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented May 2, 2026

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 2, 2026

Open in StackBlitz

commit: 6e367c2

if ("loose" in options) {
console.warn(
"@babel/plugin-transform-template-literals: The 'loose' option has been deprecated, " +
"use the `ignoreToPrimitiveHint` and `mutableTemplateObject` assumptions instead.",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"use the `ignoreToPrimitiveHint` and `mutableTemplateObject` assumptions instead.",
"use the `ignoreToPrimitiveHint` and `mutableTemplateObject` assumptions instead (https://babeljs.io/assumptions).",

(and in all the others too)

@nicolo-ribaudo nicolo-ribaudo added PR: Deprecation 📢 A type of pull request used for our changelog categories labels May 5, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af53ab46e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/babel-plugin-transform-for-of/src/index.ts Outdated
@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

"use the `privateFieldsAsProperties`, `privateFieldsAsSymbols` and `setPublicClassFields` assumptions instead. (https://babeljs.io/assumptions).",

P2 Badge Avoid recommending mutually exclusive assumptions

When users migrate loose: true by enabling every assumption listed in this warning, the plugin forwards them into createClassFeaturePlugin, which rejects privateFieldsAsProperties and privateFieldsAsSymbols when both are true (packages/babel-helper-create-class-features-plugin/src/index.ts:68). This makes the suggested replacement configuration throw before any transform runs instead of preserving the deprecated option's behavior.


"use the `privateFieldsAsProperties`, `privateFieldsAsSymbols` and `setPublicClassFields` assumptions instead. (https://babeljs.io/assumptions).",

P2 Badge Avoid recommending mutually exclusive assumptions

When users migrate loose: true by enabling every assumption listed in this warning, the class-features helper rejects privateFieldsAsProperties and privateFieldsAsSymbols when both are true (packages/babel-helper-create-class-features-plugin/src/index.ts:68). Following this message for #x in obj therefore produces a configuration error rather than a working replacement for the deprecated option.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

/** @deprecated Use the `iterableIsArray` assumption instead. */

P2 Badge Mention iterator closing in the deprecated type hint

For TypeScript users migrating from loose: true, this generated JSDoc only points them at iterableIsArray, but the plugin still maps the old option to skipForOfIteratorClosing below (api.assumption("skipForOfIteratorClosing") ?? options.loose). Following this hint alone leaves iterator closing enabled, so non-array iterators with return() behave differently after the migration; the fresh evidence is that the runtime warning was updated to mention both assumptions, but the exported deprecation hint was not.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

"@babel/plugin-transform-arrow-functions: The 'spec' option has been deprecated, " +
"use the 'noNewArrows' assumption instead. (https://babeljs.io/assumptions).",

P2 Badge Clarify the inverted spec migration

When this warning is shown for spec: true, the behavior users need to preserve is noNewArrows = false because the code below computes it as api.assumption("noNewArrows") ?? !options.spec. Following the warning literally and setting assumptions.noNewArrows: true changes the generated arrow-function semantics, so the deprecation message should spell out the inverted mapping (spec: true -> noNewArrows: false, and vice versa).

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

I'd like to merge this and release soon the next RC.

I think the above suggestion from codex is an improvement, the rest looks good.

Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Thank you.

A few wording fixes to indicate that privateFieldsAsProperties and privateFieldsAsSymbols are exclusive, and generally privateFieldsAsProperties should be preferred unless user run into specific shadowing issue.

Comment thread packages/babel-plugin-transform-private-property-in-object/src/index.ts Outdated
Comment thread packages/babel-plugin-transform-private-methods/src/index.ts Outdated
Comment thread packages/babel-plugin-transform-private-methods/src/index.ts Outdated
Comment thread packages/babel-plugin-transform-private-property-in-object/src/index.ts Outdated
Co-authored-by: Huáng Jùnliàng <[email protected]>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55fc4d0455

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/babel-plugin-transform-arrow-functions/src/index.ts Outdated
Comment thread packages/babel-plugin-transform-arrow-functions/src/index.ts Outdated
@nicolo-ribaudo nicolo-ribaudo merged commit 7a3142c into babel:main May 12, 2026
101 of 102 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Deprecation 📢 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants