-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Export more Node tests for use in public API #52284
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
Conversation
Why would we export |
It's mentioned in isExpression's doc comment. |
Should we do the same thing for other aggregate node test functions like Originally, |
When I added I've been meaning to add a separate file like |
Yes, definitely; I'm going through now and exporting the ones that are used in visitEachChild, our own transformers, etc. I'll look into |
By "also isStatement", do you mean For now while in draft I just exported |
That's an interesting idea; we already have |
And if you have a better method you want to do, by all means feel free to do it; I was just sending this PR ASAP just so downstream users have something to use for the new test-requiring stricter API. |
No, I meant |
I was just confused by the sentence:
As it says "also isStatement" when the first part mentioned that same function; I was just looking for what I was supposed to be modifying, if anything. |
I'd prefer to keep single-node tests in a separate file from aggregate node tests so I can eventually write lint rules to enforce their structure and avoid issues like the change that spurred the creation of |
Ah, I missed that bit. I've edited my comment to reference the correct function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some aggregate node tests we should include that aren't public yet. We should ensure this is limited only to the node tests needed validate child properties of each Node
(such as those used explicitly in visitEachChild
).
Some node tests we're not exporting, but should, include:
isClassElement
isTypeElement
isObjectLiteralElement
isDeclaration
The first three are already exported, but let me export |
Aside from my comment on |
After #49929, we will expect downstream users to use more node tests when visiting the AST;
isExpression
is one function that is very commonly used in our own transforms and likely should be exported.I'm not sure if there are any other tests we should export; probably worth a grep.