qwik
qwik copied to clipboard
Eslint: detect bad usage of use-methods
Is your feature request related to a problem?
use- methods can only be called in specific situations, and right now only the runtime will error after execution. It should be easy to detect at linting time using eslint:
Describe the solution you'd like
Rules
- They can only be called at the root level of a function / arrow function context, not inside branches or other conditional blocks
- They can only be called in component$
- They can only be called from another use- method. (allowing composition)
Describe alternatives you've considered
Improve errors in the runtime for this particular issue
Additional context
No response