-
Couldn't load subscription status.
- Fork 49.7k
[autodeps] Support namespaces #32162
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
| } else if ( | ||
| value.kind === 'PropertyLoad' && | ||
| typeof value.property === 'string' && | ||
| autodepModuleLoads.has(value.object.identifier.id) |
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.
codestyle nit (feel free to take or leave it) -- I find it's easier to read long nested if-else chains if the outer / inner ifs are simple. e.g.
for (const instr of block.instructions) {
if (value.kind === "FunctionExpression") {
...
} else if (value.kind === "PropertyLoad") {
const moduleTarget = autodepModuleLoads.get(
value.object.identifier.id,
);
if (...) {
...
}
} else if (value.kind === "CallExpression" || value.kind === "MethodCall") {
...
}
}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.
That's reasonable! I see why that would be easier to read
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.
Awesome, shipit! 🛳️
| @@ -1,9 +1,6 @@ | |||
| // @inferEffectDependencies | |||
| import * as React from 'react'; | |||
| import React from 'react'; | |||
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.
Ahh makes sense, thanks for checking the ImportDefault case!
Summary: Summary: Correctly supports React.useEffect when React is imported as `import * as React from 'react'` (as well as other namespaces as specified in the config). Test Plan:
Summary: Summary: Correctly supports React.useEffect when React is imported as
import * as React from 'react'(as well as other namespaces as specified in the config).
Test Plan:
Stack created with Sapling. Best reviewed with ReviewStack.