Skip to content

Fix incomplete visitor keys #17019

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

Merged
merged 6 commits into from
Dec 12, 2024
Merged

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Dec 12, 2024

Q                       A
Fixed Issues? Babel does not generate the options property of the TSImportType.
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR we ensure that for every AST node, its visitor keys always include the properties whose value is an AST node, with few exemptions. The new test detects quite a few incomplete visitor keys and they are now fixed in this PR.

This PR avoids builder changes so that it can be shipped in patch release. We can sync the builder with visitors in minor release.

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: generator pkg: types labels Dec 12, 2024
@babel-bot
Copy link
Collaborator

babel-bot commented Dec 12, 2024

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

Copy link
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

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

Nice!

node[field].type &&
!(
ignoredVisitorKeysCheckTypes[type] === true ||
ignoredVisitorKeysCheckTypes[type]?.[field] === true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ignoredVisitorKeysCheckTypes[type]?.[field] === true
(ignoredVisitorKeysCheckTypes[type] && ignoredVisitorKeysCheckTypes[type][field] === true)

to fix ci

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Didn't notice this comment when I pushed the same fix.

@JLHwung JLHwung merged commit 8b89074 into babel:main Dec 12, 2024
55 checks passed
@JLHwung JLHwung deleted the fix-incomplete-visitor-keys branch December 12, 2024 18:40
@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 Mar 14, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2025
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: generator pkg: types 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.

4 participants