Skip to content

Fix incomplete visitor keys#17019

Merged
JLHwung merged 6 commits intobabel:mainfrom
JLHwung:fix-incomplete-visitor-keys
Dec 12, 2024
Merged

Fix incomplete visitor keys#17019
JLHwung merged 6 commits intobabel:mainfrom
JLHwung:fix-incomplete-visitor-keys

Conversation

@JLHwung
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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!

Comment thread packages/babel-types/test/fields.js Outdated
node[field].type &&
!(
ignoredVisitorKeysCheckTypes[type] === true ||
ignoredVisitorKeysCheckTypes[type]?.[field] === true
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
ignoredVisitorKeysCheckTypes[type]?.[field] === true
(ignoredVisitorKeysCheckTypes[type] && ignoredVisitorKeysCheckTypes[type][field] === true)

to fix ci

Copy link
Copy Markdown
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
@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