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

linter: incorrect React hook linting in Svelte files #8003

Open
notramo opened this issue Dec 18, 2024 · 0 comments
Open

linter: incorrect React hook linting in Svelte files #8003

notramo opened this issue Dec 18, 2024 · 0 comments
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@notramo
Copy link

notramo commented Dec 18, 2024

What version of Oxlint are you using?

latest

What command did you run?

oxlint -A

What does your .oxlint.json config file look like?

No config file.

What happened?

× eslint-plugin-react-hooks(rules-of-hooks): React Hook "useIntersectionObserver" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.

This error is thrown for the <script> part of a Svelte component. It contains a call of useIntersectionObserver(), which is named like a React hook but the name is the only similarity. It's a Svelte-only library and the function doesn't work like a React hook at all.

Please turn off this rule in Svelte files.

@notramo notramo added A-linter Area - Linter C-bug Category - Bug labels Dec 18, 2024
camc314 pushed a commit that referenced this issue Dec 28, 2024
…8165)

because of #8003

I used the FrameworkFlags in hope they are only active in `.vue` and
`.svelte` files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

1 participant