Skip to content

Forbid initializerless using#16403

Merged
JLHwung merged 2 commits intobabel:mainfrom
JLHwung:forbid-initializerless-using
Apr 3, 2024
Merged

Forbid initializerless using#16403
JLHwung merged 2 commits intobabel:mainfrom
JLHwung:forbid-initializerless-using

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Apr 2, 2024

Q                       A
Fixed Issues? The explicit-resource-mangament plugin throws internal transform error on a using declaration without initializer (REPL)
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Per spec 14.3.1.1, it is an early error if a using declaration has no initializer, so we should reject such production in the parser.

New test cases are added. Some of current test cases are modified so that they can throw expected errors.

@JLHwung JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Explicit Resource Management labels Apr 2, 2024
@babel-bot
Copy link
Collaborator

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

@JLHwung
Copy link
Contributor Author

JLHwung commented Apr 2, 2024

@fisker The prettier test is breaking because we will forbid using f; without an initializer. Can you update the test cases like a3beeb2? The current babel parser should already work for the revised test cases.

Copy link
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 would also be ok with releasing this PR with the prettier tests failing (and then it would be easier for Prettier maintainers to just update Babel and see exactly what they need to change to make tests pass)

@JLHwung JLHwung merged commit af4f9cd into babel:main Apr 3, 2024
@JLHwung JLHwung deleted the forbid-initializerless-using branch April 3, 2024 15:34
fisker added a commit to prettier/prettier that referenced this pull request Apr 4, 2024
@fisker
Copy link
Contributor

fisker commented Apr 4, 2024

Will fix the test in prettier/prettier#16130

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Explicit Resource Management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants