Skip to content
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

False positive on useTranslations() from next-intl #9

Closed
HowManyOliversAreThere opened this issue Apr 19, 2024 · 1 comment · Fixed by #10
Closed

False positive on useTranslations() from next-intl #9

HowManyOliversAreThere opened this issue Apr 19, 2024 · 1 comment · Fixed by #10

Comments

@HowManyOliversAreThere
Copy link

When using the line const t = useTranslations(); (from next-intl) in a Next.js React component, it falsely triggers the react-server-components/use-client rule. At a guess I would assume this to be because useTranslations() support both server and client side rendering and as such the inspection may be falsely flagging something inside of it.

In the short term we are going to just individually prefix all of our useTranslations lines with // eslint-disable-next-line react-server-components/use-client lines above them, but this is unwieldy and would prefer to be avoided. It would be good if this false positive can be fixed, or if we could configure some global pattern for lines that can be ignored by this rule.

@roginfarrer
Copy link
Owner

Added an option to make exceptions for hooks in 1.2.0

https://github.com/roginfarrer/eslint-plugin-react-server-components/releases/tag/v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants