Skip to content
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

Forbid initializerless using #16403

Merged
merged 2 commits into from Apr 3, 2024
Merged

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
50 of 52 checks passed
@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

5 participants