-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[code-infra] Remove rsc-builder #45079
Conversation
Netlify deploy previewhttps://deploy-preview-45079--material-ui.netlify.app/ Bundle size report |
statement.expression.value === 'use client', | ||
); | ||
hasUseServerDirective = hasDirective(node, 'use server'); | ||
hasUseClientDirective = hasDirective(node, 'use client'); | ||
}, | ||
CallExpression(node) { | ||
if ( | ||
!hasUseClientDirective && |
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.
Shouldn't this check for !hasUseServerDirective
as well? 🤔
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.
No, the marked APIs are not allowed in server components. i.e. the plugin should flag when 'use client'
is missing while client APIs are used in the file. The hasUseServerDirective
is only there to prevent adding a 'use client'
when there already is a 'use server'
while autofixing. This is a contradiction that the programmer must resolve manually.
We're doing this with eslint now. The rule is auto-fixable. Added some types to the eslint plugin as well and cleaned it up, functionally no difference.